logUnhandledException

logUnhandledException()

(error: any): void

Log given error and emit an event on the UnhandledErrorEmitter instance.

Example

import { logUnhandledException } from "typescene";
myActivity.activateAsync().catch(logUnhandledException);

Handling errors

To handle errors in some other way (other than logging to the console), observe events on the singleton UnhandledErrorEmitter instance.

UnhandledErrorEmitter.observe(
  class {
    onEvent(e: UnhandledErrorEvent) {
      if (e.error) {
        // ... (do something with the error, e.g.
        // send to reporting service back end)
      }
    }
  }
);