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

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

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

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

tjconcept opened this issue Aug 5, 2015 · 3 comments

Comments

@tjconcept
Copy link

@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
Copy link
Contributor

@bergus bergus commented Aug 5, 2015

Hm, the error of rjb is nowhere handled?

@tjconcept
Copy link
Author

@tjconcept 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
Copy link
Author

@tjconcept 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.