It's worth noting that if any of the promises rejects the entire Promise.all() will be rejected, which is fine if you have to sum two numbers BUT it might not be the case if you are building a crawler (for example).
Maybe one's intention is "fire off these 10 operations and tell me which ones failed and which ones didn't" which I don't think you can do with the ES6 API easily.
Twisted has DeferredList which allows the user to fire off N deferred/promises and then attach a callback to the aggregate so you can iterate on the results and check which one succeeded and which one failed.
Thank you Darius!
It's worth noting that if any of the promises rejects the entire
Promise.all()
will be rejected, which is fine if you have to sum two numbers BUT it might not be the case if you are building a crawler (for example).Maybe one's intention is "fire off these 10 operations and tell me which ones failed and which ones didn't" which I don't think you can do with the ES6 API easily.
Twisted has DeferredList which allows the user to fire off N deferred/promises and then attach a callback to the aggregate so you can iterate on the results and check which one succeeded and which one failed.
Good point, didn't think about that. 👍