DEV Community

Discussion on: How to wait for multiple Promises?

Collapse
 
abrain profile image
Andreas Brain

Since Node.js 12.9.0, there is a fault-tolerant version of Promise.all() available out of the box: Promise.allSettled(). Browser support seems also quite good, but not 100 %.

Collapse
 
mariokandut profile image
Mario

Promise.allSettled is another way to handle multiple promises. The difference is that Promise.all rejects as soon one rejects, Promise.allSettled() returns a promise that resolves after all have rejected or resolved. This means it is more fault-tolerant, you can achieve the same with adding a catch handler to the promise.all, see example in article. I think I will add an article about the difference Promise.all and Promise.allSettled. Thanks for the constructive input.