On 10/30/19 6:19 PM, Jan-Ivar Bruaroey wrote:
This always seemed trivial to me to do with:

     Promise.all(promises.map(p => p.catch(e => e)))

This has different semantics from Promise.allSettled, right? In particular, it effectively treats rejected promises as resolved with the rejection value, forgetting the fact that they were rejected. Promise.allSettled, on the other hand, preserves information about the state.

I think you can still polyfill it, using something like:

Promise.all(promises.map(p => p.then(
  v => { { status: "fulfilled", value: v } },
  e => { { status: "rejected", reason: e } }));

though I think this might create more temporary Promises than allSettled does...

dev-platform mailing list

Reply via email to