1

I have a list of task where some are expect to be rejected and while others are resolved.

The tasks don't have to be done in any particular order. However, it should not go into the catch clause unless all are rejected. Alternatively, I would like it to never go into catch clause but I inspect the status of each returning task myself to check if it was resolved or rejected.

Also I might need all resolved tasks to walk further down the promise chains, and walking into the next one if it is successful.

It seems like with all, a single rejected task can throw it into the catch clause. I don't want any either, since I expect all to be done.

How would I be able to do that?

huggie
  • 17,587
  • 27
  • 82
  • 139

1 Answers1

1

Bluebird has Promise#settle:

This method is useful for when you have an array of promises and you'd like to know when all of them resolve - either by fulfilling or rejecting.

I am not aware of a Bluebird method that combines both the functionality of Promise#settle and "it should not go into the catch clause unless all are rejected" however it will be quite easy to find one if it does exist by taking a look at the documentation over on GitHub.

sdgluck
  • 24,894
  • 8
  • 75
  • 90