0

The function makeRequest() returns a promise. Suppose 'secondPath' in promises returns a reject/error, i want to custom handle it for that case. but promises.all() is all or none.

promises=["firstPath","secondPath","thirdPath"]
const completeResult = Promise.all(promises).then((result) => {
  console.log(result)
});

function makeRequest(path){
        const options={
            type: "GET",
            url: "https://localhost:7000/${path}"
        }
        return request(options);
}
AB B
  • 1
  • 1
  • See the linked question's answers. Basically, add a rejection handler to that specific promise (and then put the promise that creates into `Promise.all`) or use [`Promise.allSettled`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled) instead and deal with it afteward. – T.J. Crowder Mar 02 '21 at 14:59
  • 1
    @T.J.Crowder thank you. appreciate your help big time – AB B Mar 02 '21 at 15:37

0 Answers0