alexa

Catch() is not handling rejection of promise in case multiple javascript Promises to settle with Promise.allSettled() in node.js ?

Catch() is not handling rejection of promise in case multiple javascript Promises to settle with Promise.allSettled() in node.js ?

The catch statement will be executed when the error occurs. As the Promise.allSettled() always resolves, you can manually throw an error i.e.

 

 if(posts.status === "rejected"){
  throw new Error('a status was rejected'); 
}

188 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online

Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry