-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Unhandled rejection from .map()
and .filter()
in v3.5.1
#1487
Comments
This produces an unhandled rejection: const p = Promise.reject( new Error('foo') );
Promise.map(p, () => {} )
.catch( () => {} ); |
Having looked into this further, I think this problem was actually introduced a while back in a PR that I submitted: #1221 That PR introduced a call to I guess what should be happening is that the input promise should be checked for if it's already rejected and if it is the promise returned by |
Actually, the tick should be introduced after the first round of iteration, but before the map handers are called. Otherwise there can also be unhandled exceptions on any rejected promises in the input array. At present, the following also creates an unhandled exception: const arr = [ Promise.reject( new Error('foo') ) ];
Promise.map( arr, () => {} ).catch( () => {} ); |
Please see PR #1489 which fixes this. |
I've experienced this issue as well. What is the status of this issue? the fix is planned to be merged soon? |
Please answer the questions the best you can:
3.5.1
Node 6.12.2, Mac OS 10.12.6
No. Issue not present in bluebird 3.5.0.
Chaining
.map()
or.filter()
on to a rejected promise leads to an unhandled rejection, even when.catch()
handler is attached further down the chain.With bluebird v3.5.1, the above produces
Unhandled rejection Error: foo
. In v3.5.0 no unhandled rejection is created.I assume is caused by 48c8591 but I can't understand why!
Don't know if this is related to #1468.
The text was updated successfully, but these errors were encountered: