I am writing Javascript that should execute these events in the following order:
- Failure of multiple API calls
- Once all calls are completed and the answers are back, execute a line of code
It sounds simple, but the tricky part is that I cannot use Promises.all () because I still want this line of code to be executed after all the promises are executed, successfully or not. If I do not understand Promises.all (), one of the unsuccessful actions will lead to the fact that the line of code will not be executed in then () and will be executed too quickly with an error ().
I might very well have missed something obvious, but the only other way I can see is to bind the API promises call together, but this will not immediately launch them all. So basically I think that I need a version of Promises.all () that is not “fast”.
What is the right way to do this?
source
share