The JavaScript Promise.allSettled() method
The Promise.allSettled() method waits for all promises to finish and returns an array describing each outcome: { status: "fulfilled", value } or { status: "rejected", reason }. Unlike Promise.all(), it never rejects, so one failure doesn't lose the other results.
Overview
Promise.allSettled() runs several promises in parallel and waits for every one to settle (fulfill or reject), then hands you an array reporting what happened to each. Each entry is an object: { status: "fulfilled", value } for successes and { status: "rejected", reason } for failures.
The key difference from Promise.all() is that it never rejects. Promise.all() fails fast (one rejection discards all results), which is wrong when you want every operation's outcome regardless of individual failures. Loading several independent widgets, sending a batch of requests, settling a list of uploads: you want to know which succeeded and which failed, and that's exactly what allSettled() gives you.
Because results come back uniformly (no throw), you process them by checking status: filter the "fulfilled" ones for their values, the "rejected" ones for their errors. It pairs with the rest of the Promise combinators: all() (all must succeed), race() (first to settle), and any() (first to fulfill).
Syntax
const results = await Promise.allSettled([p1, p2, p3]);
results.forEach(r => {
if (r.status === "fulfilled") console.log(r.value);
else console.log("failed:", r.reason);
});
Parameters
The Promise.allSettled() method accepts the following parameters.
| Parameter | Description |
|---|---|
iterable |
An iterable (usually an array) of promises. Resolves to an array of { status, value } / { status, reason } objects. |
Example
<pre id="out" style="font:14px ui-monospace,monospace"></pre>
<script>
const ok = (v) => Promise.resolve(v);
const fail = (e) => Promise.reject(e);
Promise.allSettled([ok('A'), fail('boom'), ok('C')]).then(results => {
document.getElementById('out').textContent =
results.map(r =>
r.status === 'fulfilled' ? 'ok: ' + r.value : 'err: ' + r.reason
).join('\n');
});
// ok: A / err: boom / ok: C
</script>
Best practices
- Use
allSettled()when you want every result, even if some promises reject. - Use Promise.all() instead when any failure should abort the whole batch.
- Process results by checking each
status("fulfilled"vs"rejected"). - It never rejects, so you usually don't need a try...catch around it.
Frequently asked questions
What is the difference between Promise.all() and Promise.allSettled()?
allSettled() waits for all and reports each outcome, never rejecting.When should I use Promise.allSettled()?
How do I read the results of allSettled()?
status: check for "fulfilled" (with value) or "rejected" (with reason).