Skip to content
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
Closed

Promise.join unhandled exceptions #373

bjyoungblood opened this issue Oct 31, 2014 · 0 comments

Comments

@bjyoungblood
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant