fix(logger): log promise in unhandledRejection event

This commit is contained in:
Matteo Pagliazzi 2019-04-02 22:32:57 +02:00
parent e1f9643ffd
commit 6c4e1a326f

View file

@ -84,8 +84,9 @@ let loggerInterface = {
// Logs unhandled promises errors
// when no catch is attached to a promise a unhandledRejection event will be triggered
process.on('unhandledRejection', function handlePromiseRejection (reason) {
loggerInterface.error('unhandledPromiseRejection', reason);
// reason is the error, p the promise where it originated
process.on('unhandledRejection', function handlePromiseRejection (reason, p) {
loggerInterface.error(reason, 'unhandledPromiseRejection at', p);
});
module.exports = loggerInterface;