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); } 
2
  • 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 instead and deal with it afteward. Commented Mar 2, 2021 at 14:59
  • 1
    @T.J.Crowder thank you. appreciate your help big time Commented Mar 2, 2021 at 15:37

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.