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 Static Readonly | handler for logging exception to console | |
errorLog(e: any): void Static Readonly | handler for logging exception with Logger | |
handle(error: any, notifyTelemetry: booleantrue): void Static | call this method when an unexpected error happens so the global handler can process it. | |
reThrowDeferred(e: any): __global.NodeJS.Timeout Static Readonly | handler for re-throwing exceptions from an asynchronous interval (so the current call stack is not aborted) | |
reThrowImmediate(e: any): never Static Readonly | handler for re-throwing exceptions directly | |
setHandler(handler: OnUnexpectedError): OnUnexpectedError Static | establish a new global unexpected error handler. |
Defined in
Last Updated: 23 November, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.