When using Promise.join, unhandled errors/exceptions result in an error message with no stack trace.
Adding a .catch and immediately re-throwing (as shown in the second case below) works as expected. Similarly, adding a Promise.onPossiblyUnhandledRejection handler also results in the correct error / stack trace.
The following code can be used to reproduce this:
var Promise = require('bluebird');
var fs = require('fs');
Promise.promisifyAll(fs);
function rejectResult() {
return fs.readFileAsync('no such file');
}
function goodResult() {
return Promise.resolve('test');
}
Promise.all([ rejectResult(), goodResult() ]).then(function() {});
// Possibly unhandled Error: ENOENT, open 'no such file'
Promise.join(rejectResult(), goodResult(), function(file, val) {}).catch(function(err) {
throw err;
});
// Possibly unhandled Error: ENOENT, open 'no such file'
Promise.join(rejectResult(), goodResult(), function(file, val) {});
// Possibly unhandled (<{"p5":null,"p4":null,"p3":null,"p2":"t...>, no stack trace)
When using
Promise.join, unhandled errors/exceptions result in an error message with no stack trace.Adding a
.catchand immediately re-throwing (as shown in the second case below) works as expected. Similarly, adding aPromise.onPossiblyUnhandledRejectionhandler also results in the correct error / stack trace.The following code can be used to reproduce this: