Skip to content

Commit b1b4827

Browse files
committed
Include unhandled rejections
1 parent b10ca71 commit b1b4827

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function prexit(signals, fn) {
2121
}))
2222
}
2323

24-
prexit.signals = ['beforeExit', 'uncaughtException', 'SIGTSTP', 'SIGQUIT', 'SIGHUP', 'SIGTERM', 'SIGINT']
24+
prexit.signals = ['beforeExit', 'uncaughtException', 'unhandledRejection', 'SIGTSTP', 'SIGQUIT', 'SIGHUP', 'SIGTERM', 'SIGINT']
2525
prexit.logExceptions = true
2626

2727
prexit.last = fn => last.push(fn)
@@ -54,8 +54,8 @@ function handle(signal, fn) {
5454
const fns = handlers[signal] = [fn]
5555

5656
process.on(signal, function(error) {
57-
if (signal === 'uncaughtException' && prexit.logExceptions)
58-
console.error('yooo', (error && 'stack' in error) ? error.stack : new Error(error).stack) // eslint-disable-line
57+
if ((signal === 'uncaughtException' || signal === 'unhandledRejection') && prexit.logExceptions)
58+
console.error((error && 'stack' in error) ? error.stack : new Error(error).stack) // eslint-disable-line
5959

6060
exitPromise = Promise.all(fns.map(fn =>
6161
Promise.resolve(fn(signal, error))

0 commit comments

Comments
 (0)