diff --git a/packages/core/src/node/backend-application.ts b/packages/core/src/node/backend-application.ts index 8926a0afd307f..cd8401f652971 100644 --- a/packages/core/src/node/backend-application.ts +++ b/packages/core/src/node/backend-application.ts @@ -159,12 +159,7 @@ export class BackendApplication { protected readonly contributionsProvider: ContributionProvider, @inject(BackendApplicationCliContribution) protected readonly cliParams: BackendApplicationCliContribution) { process.on('uncaughtException', error => { - if (error) { - console.error('Uncaught Exception: ', error.toString()); - if (error.stack) { - console.error(error.stack); - } - } + this.handleUncaughtError(error); }); // Workaround for Electron not installing a handler to ignore SIGPIPE error @@ -335,4 +330,13 @@ export class BackendApplication { return this.stopwatch.startAsync(name, `Backend ${name}`, fn, { thresholdMillis: TIMER_WARNING_THRESHOLD }); } + protected handleUncaughtError(error: Error): void { + if (error) { + console.error('Uncaught Exception: ', error.toString()); + if (error.stack) { + console.error(error.stack); + } + } + } + }