setErrorHandler
Sets a global unhandled error handler.
setErrorHandler(f: (err: unknown) => void): void
Notes
- This method replaces the current handler, if any. it’s not cleared by GlobalContext.clear() either; and must not be set in a test context to allow the test runner to catch unhandled errors.
- The default error handler logs all errors using LogWriter.error() (i.e.
app.log.error(...)
). Consider using a log sink instead of changing this behavior — refer to app.addLogHandler().
Parameters
- f — A handler function, which should accept a single error argument (with
unknown
type)
Related
- class GlobalContextA singleton class that represents the global application state.