AppContext.setErrorHandler()
Sets a global unhandled error handler.
static setErrorHandler(f: (err: unknown) => void): void;
Notes
- This method replaces the current handler, if any, and is not cleared by AppContext.clear().
- 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 LogWriter.addHandler. - In a test handler context, the global error handler may be overridden to re-throw errors during tests.
Parameters
- f — A handler function, which should accept a single error argument (with
unknowntype)
Related
class AppContext
A singleton class that represents the global application state.
