Presently, my code looks like this:
const promise1 = aPromiseCall().then(r => logger(r)).catch(e => logger(e));
const promise2 = anotherPromiseCall().then(r => logger(r)).catch(e => logger(e));
Within an async function, I execute the following:
const results = Promise.all([promise1, promise2]);
I have structured it in this manner to ensure that if promise1 fails, promise2 can still be executed. However, I am uncertain whether this is the most optimal approach. Should I include those then, catch
statements in each individual promise, or is there a more conventional way to achieve the same result?
Additionally, I want to guarantee that ALL promises are either resolved or rejected before proceeding with the execution of my code, which is why I grouped them within a Promise.all
block.