Created
February 28, 2019 20:37
-
-
Save clohr/d1a36f62d2849ea2c55e92c278b0ff92 to your computer and use it in GitHub Desktop.
Guarantee that all responses are returned from Promise.all regardless of error status
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const queues = [...LIST_OF_PROMISES] | |
// this maps over all the queued responses to guarantee that all responses are returned regardless of error status | |
return Promise.all(queues.map(q => { | |
return q.catch(err => ({status: err.status})) | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment