You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unhandled rejection when joining chains with common rejected parent #645
Maybe I should do this kind of stuff in another way, but I've hit it a couple of times now and it's extremely hard to debug and, at least in my head, seems inconsistent and unintuitive.
varPromise=require('bluebird');vara=Promise.try(function(){thrownewError('Something went wrong');});varb=Promise.try(function(){thrownewError('Something went wrong here as well');});varc=Promise.join(a,b).spread(function(a,b){returna+b;});Promise.join(a,c).spread(function(a,product){// ...}).catch(Error,function(e){console.log(e);});
The workaround is to "silent" the a-chain in the last join with .catch(noop) (#483 in the future), but then c needs to know about the fact that a is part of c which is not always easy.
though when I proposed the original change for join I didn't really mean to suggest deprecating the old one - its just that it was much easier to model the type signatures in TypeScript for the new syntax
Hmm.. I really think of join and spread as two different things, just as resolve and then. spread is calling the function with .apply or using the spread operator from ES6, regardless of the actual resolved value. join is combining several values into an array of resolved values - like using rest parameters.
Activity
benjamingr commentedon Jun 7, 2015
Can you check if this happens with the correct .join syntax?
tjconcept commentedon Jun 7, 2015
It does not happen with
join(a, c, fn), if that is what you mean?I was not aware this was incorrect.. How come?
benjamingr commentedon Jun 7, 2015
The old join syntax was deprecated and then superseded with the (a, b, fn) one a while ago.
That said, the face of still works (the old syntax) means that either:
Either is fine by me - the current behavior isn't good.
tjconcept commentedon Jun 7, 2015
What were the reasons for deprecating the "old" syntax? I think it aligns nicely with
.all,.propsand so forth. How is it different?How would I do something like this with the "new" syntax:
spion commentedon Jun 8, 2015
You can always use Promise.all
though when I proposed the original change for
joinI didn't really mean to suggest deprecating the old one - its just that it was much easier to model the type signatures in TypeScript for the new syntaxtjconcept commentedon Jun 9, 2015
Hmm.. I really think of
joinandspreadas two different things, just asresolveandthen.spreadis calling the function with.applyor using the spread operator from ES6, regardless of the actual resolved value.joinis combining several values into an array of resolved values - like using rest parameters.tjconcept commentedon Jun 10, 2015
Seems like
.allis giving me the same behaviour as.join().spread()with an uncaught exception.petkaantonov commentedon Jun 11, 2015
Yea it's a bug that I fixed a while ago in 3.0 with b182d5b . Maybe it could be backported
petkaantonov commentedon Jun 14, 2015
Fixed in 2.9.28