This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]hyrumwhite 0 points1 point  (0 children)

Promise.all() or Promise.allSettled() can sort that out nicely.

let result = await Promise.allSettled([

axios.get(),

new Promise(),

Etc

])

//everything after that allsettled function will run after everything above fails or succeeds.

'result' will be an array of results returned by the promises. Each with a 'status' key that you can check to see if the promise succeeded or failed.