I am having a piece of code where I am adding a few Async operations to a promise array and calling Promise.all to resolve all of them and await the result. I have an expectation to check for failure of second operation and perform operation one from its catch block if it so happens. If I am attaching a catch block to one of the promises of this array and performing an async operation can I add to the same promise array or am I better off to await this operation separately.
const promises = [];
promises.push(performAsync1(record))
promises.push(performAsync2().catch(() =>
console.error("Async2 Failed");
promises.push(performAsync1(failedRecord));
}
const responses = await Promise.all(promises);