Closed
Description
The following program reproduces my problem:
const process = require('process');
process.on('unhandledRejection', function(reason) {
console.log('unhandledRejection:', reason);
});
Promise
.resolve('resolve')
.then(function() {
return Promise.reject('reject');
})
.catch(function(e) {
console.log('catch:', e);
});
// Promise.reject().catch(function(){});
This is the output:
catch: reject
unhandledRejection: reject
First the catch handler gets called, which is expected. But after that the unhandledRejection
event handler gets called too, which is unexpected to me.
If the //
on the last line are removed, then the unhandledRejection
event handler gets not called. This line should have no effect on the first promise, but apparently it has.
Tested with v2.2.1 on OSX and linux.
Metadata
Metadata
Assignees
Labels
No labels