diff --git a/src/app.ts b/src/app.ts index bd631062..52d2a547 100644 --- a/src/app.ts +++ b/src/app.ts @@ -60,6 +60,7 @@ import { RootData } from './RootData.js'; import { GBSSR } from '../packages/core.gbapp/services/GBSSR.js'; import { Mutex } from 'async-mutex'; import { GBVMService } from '../packages/basic.gblib/services/GBVMService.js'; +import e from 'express'; /** * General Bots open-core entry point. @@ -108,6 +109,7 @@ export class GBServer { // Setups global error handlers. process.on('unhandledRejection', (err, p) => { + err = err['e'] ? err['e'] : err; GBLog.error(`UNHANDLED_REJECTION(promises): ${err.toString()} ${err['stack'] ? '\n' + err['stack'] : ''}`); if (err['response']?.obj?.httpStatusCode === 404) { GBLog.warn(`Check reverse proxy: ${process.env.BOT_URL} as it seems to be invalid.`); @@ -116,6 +118,7 @@ export class GBServer { process.on('uncaughtException', (err, p) => { if (err !== null) { + err = err['e'] ? err['e'] : err; GBLog.error(`UNCAUGHT_EXCEPTION: ${err.toString()} ${err['stack'] ? '\n' + err['stack'] : ''}`); } else { GBLog.error('UNCAUGHT_EXCEPTION: Unknown error (err is null)');