UnexpectedErrors Class
Utility for handling/reporting unexpected runtime errors. This class establishes a global handler for
unexpected errors, and programmers should use its handle
method when they occur. Generally, unexpected
errors should not cause program termination, and should instead be logged and swallowed. However, for
development/debugging, it can be helpful to re-throw exceptions so they are not missed.
Methods
Name | Description | |
---|---|---|
addTelemetry(tracker: OnUnexpectedError): () => void Static | Add a "telemetry tracker" for unexpected errors. | |
consoleLog(e: any): void StaticReadonly | handler for logging exception to console | |
errorLog(e: any): void StaticReadonly | handler for logging exception with Logger | |
handle(error: any, notifyTelemetry: boolean = true): void Static | call this method when an unexpected error happens so the global handler can process it. | |
reThrowDeferred(e: any): Timeout StaticReadonly | handler for re-throwing exceptions from an asynchronous interval (so the current call stack is not aborted) | |
reThrowImmediate(e: any): never StaticReadonly | handler for re-throwing exceptions directly | |
setHandler(handler: OnUnexpectedError): OnUnexpectedError Static | establish a new global unexpected error handler. |
Defined in
Last Updated: 20 June, 2023