DEV Community

Discussion on: Avoid async/await hell

Collapse
 
miketalbot profile image
Mike Talbot ⭐

Nicely put. One note:

await Promise.all() will throw an exception if either promise rejects rather than returning.

Collapse
 
kaleman15 profile image
Kevin Alemán

If you care about the actual resolve/rejection, take a look at Promise.allSettled, which doesn't throw on rejects

Collapse
 
judionit profile image
Judicaël Andriamahandry

yes yes, it was on the note too

Promise.allSettled will wait until every promise has either resolved or rejected

Collapse
 
igormelo profile image
Igor Melo

Usually you will want the user to try again if some of then failed