0

I have a Promise.all(promiseArr).then(()=>foo()) that I want to do foo() even if some percentage of the promises in promiseArr rejected.

It's a little ugly to do:

Promise.all(promiseArr).then(()=>foo())
.catch(()=>{/*check percentage of rejected promises and if it's good call foo()*/});

Is there a better way?

shinzou
  • 5,850
  • 10
  • 60
  • 124
  • Have you had a look at [Wait until all ES6 promises complete, even rejected promises](https://stackoverflow.com/q/31424561/1048572)? – Bergi Jun 11 '17 at 12:06
  • Take a look at [my answer](https://stackoverflow.com/a/43948154/918910) to a question of how to throttle `Promise.all`. It has a counter variable (`limit`) you can use to check against percent completed. – jib Jun 11 '17 at 12:35

0 Answers0