Skip to content

Commit d39d9ba

Browse files
committed
fix: log the Promise for debugging when an unhandledRejections occur
1 parent 8edd305 commit d39d9ba

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ process.on('uncaughtException', (err) => {
2323
}
2424
});
2525

26-
process.on('unhandledRejection', (reason) => {
26+
process.on('unhandledRejection', (reason, promise) => {
2727
if (state.shutdownInProgress) {
2828
return;
2929
}
3030

3131
try {
32-
logger.error({reason}, 'UNHANDLED REJECTION!');
32+
logger.error({ reason, promise }, 'UNHANDLED REJECTION!');
3333
} catch (ignore) {
34-
console.log('UNHANDLED REJECTION!', reason);
34+
console.log('UNHANDLED REJECTION!', reason, promise);
3535
} finally {
3636
process.exit(1);
3737
}

0 commit comments

Comments
 (0)