UNPKG

@exceptionless/node

Version:
22 lines 818 B
import { toError } from "@exceptionless/core"; export class NodeGlobalHandlerPlugin { priority = 100; name = "NodeGlobalHandlerPlugin"; _client = null; startup(context) { if (this._client) { return Promise.resolve(); } this._client = context.client; Error.stackTraceLimit = 50; process.addListener("uncaughtException", (error) => { void this._client?.submitUnhandledException(error, "uncaughtException"); }); process.addListener("unhandledRejection", (reason) => { const error = toError(reason, "Unhandled rejection"); void this._client?.submitUnhandledException(error, "unhandledRejection"); }); return Promise.resolve(); } } //# sourceMappingURL=NodeGlobalHandlerPlugin.js.map