You could do something like this:
function allSkippingErrors(promises) {
return Promise.all(
promises.map(p => p.catch(error => null))
)
}
This will resolve all the Promise
objects with errors to a null
in the resulting array. You could also keep the Error
object using .catch(error => error)
, to detect failures at the end, or resolve to an object with { status, result, error }
properties.