-
Notifications
You must be signed in to change notification settings - Fork 5
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
join() with rejection callback #1
Comments
Hey, this is the best way to observe the rejection at the moment. Unless you're reporting, you probably don't need to observe the resolution of all the rejection reasons (the Q.when(error.reasons)) — The joined callback rejects at the first opportunity, which means not all of the joined promises have been resolved, and some of them might be rejected in the future. It's also a good idea to return the result of Q.when even in callbacks, so that the promises get chained. Other than that, I'm still looking for cleaner ways to do this pattern. It might be better for join to return a function that accepts the callback and errback, passing all the values to the callback. I don't know yet, but I'll keep thinking about it. |
I noticed that my code using join() works if I require('q') but fails if I require('qq'), and it seems to be related to this. Is the version of join() in q a newer approach? I'm using this pattern:
|
qq contains an older version of join I wrote myself, but I found Mark Miller's implementation of "all", which I used to implement "join" in "q". I should remove the version in "qq" |
Or if you aren't hoping to retire qq's join outright, perhaps just rename it so it doesn't mask the one from q. That way if anyone is using it they can update with a trivial rename rather than code rework. Thanks! |
Hi Kris, I'm noob in Promises idea, and I'm wondering how to run callback on join rejection?
Since join rejection reason is a Promise I've managed to do something like: https://gist.github.com/987205
Is there any better/cleaner way to do so?
The text was updated successfully, but these errors were encountered: