Am I misunderstanding Promise.all? I have X promises in an array and i'm trying to aggregate the success/failure ratio of the array.
Here is what I think I know:
Promise.all takes an array of promises.
If all of the promises succeed then the .then
callback is ran.
If one of the promises fail then the .catch
callback is called and the argument passed in is the value of the single raised error.
There is no callback fired which is the result of all the promises if some succeed and some fail. I.e. it can't give you an array like (pseudo code) [success, fail, success, success]
- like one would expect and one can find in many JS libraries (ajax, ember, etc).
It's like the .then
is more like a .success
, not a function that always runs after all the promises are fulfilled regardless of whether some succeeded or some failed. Why doesn't have a .when
.finally
.runThisShizNoMatterWhat
?? Or am I missing something (very probable)?