New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promise.join unhandled exceptions #373

Closed
bjyoungblood opened this Issue Oct 31, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@bjyoungblood

bjyoungblood commented Oct 31, 2014

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment