From 8bb97f2e4c8e645358efb688bee116bd017f55b8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 20 May 2018 19:24:54 +0900 Subject: [PATCH] Better error reporting --- src/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index d633fcbbcb..bcd6561691 100644 --- a/src/index.ts +++ b/src/index.ts @@ -194,7 +194,12 @@ cluster.on('exit', worker => { // Display detail of unhandled promise rejection process.on('unhandledRejection', console.dir); -// Dying away... -process.on('exit', () => { - Logger.info('The process is going exit'); +// Display detail of uncaught exception +process.on('uncaughtException', err => { + console.error(err); +}); + +// Dying away... +process.on('exit', code => { + Logger.info(`The process is going exit (${code})`); });