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

Unexpected "Unhandled rejection" with "return" method #721

Closed
tjconcept opened this Issue Aug 5, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@tjconcept

tjconcept commented Aug 5, 2015

var rj = Promise.reject(new Error());

rj
    .return(Promise.join(rj))
    .spread(console.log)
    .catch(console.error);

Gives an "Unhandled rejection Error" with Bluebird 2.9.34.

The example seems freakish, but it is a distilled version of a more complex scenario where the join has more arguments.

My first thought was to swap a simple array for the join, but add another thing to the array, and you're back to square one:

var rja = Promise.reject(new Error());
var rjb = Promise.reject(new Error());

rja
    .return([ rja, rjb ])
    .spread(console.log)
    .catch(console.error);

Gives an "Unhandled rejection Error" as well.

@bergus

This comment has been minimized.

Show comment
Hide comment
@bergus

bergus Aug 5, 2015

Contributor

Hm, the error of rjb is nowhere handled?

Contributor

bergus commented Aug 5, 2015

Hm, the error of rjb is nowhere handled?

@tjconcept

This comment has been minimized.

Show comment
Hide comment
@tjconcept

tjconcept Aug 6, 2015

Yes it is. Try doing this:

var rja = Promise.resolve();
var rjb = Promise.reject(new Error());

rja
    .return([ rja, rjb ])
    .spread(console.log)
    .catch(console.error);

Whether using an array or Promise.join it is handled.

tjconcept commented Aug 6, 2015

Yes it is. Try doing this:

var rja = Promise.resolve();
var rjb = Promise.reject(new Error());

rja
    .return([ rja, rjb ])
    .spread(console.log)
    .catch(console.error);

Whether using an array or Promise.join it is handled.

@tjconcept

This comment has been minimized.

Show comment
Hide comment
@tjconcept

tjconcept Sep 9, 2015

👍
I updated Bluebird, ran the tests and poof, all "unhandled" errors were gone :)

tjconcept commented Sep 9, 2015

👍
I updated Bluebird, ran the tests and poof, all "unhandled" errors were gone :)

petkaantonov added a commit that referenced this issue Oct 26, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment