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

Any way of forcing the resolution of all promises before executing an error handler? #739

Closed
pnex2000 opened this issue Aug 24, 2015 · 1 comment

Comments

@pnex2000
Copy link

We ran into the issue where .props()/.all() will fail fast when a promise rejects when we would need all promises to be resolved before the error handler being called in order to clean up resources cleanly. Apparently this can be done correctly with .settle(), but we're making a library and .settle() puts the burden of correctly handling promise joining on the user instead of on the library. See here: reaktor/pg-using-bluebird#3

My question is, is there a way to force the resolution of all promises in the error handler instead of the collecting method? Does bluebird even permit that?

@benjamingr
Copy link
Collaborator

Since .all is specified by the ES2015 spec we can't really help you with it. That said, if you use other methods you can get an AggregateError instead which lets you access all errors - for example you can use .some with the length of the input array.

Please consider using using for resource management as it encapsulates all the logic of cleaning up after partial failures (which in my experience is hard to get right). It takes care of many of the common pitfalls.

Also, in general support questions are best off the issue tracker (in the appropriate support channels, as the contributing file outlines).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants