Open ronen-e opened 3 years ago
Where Chapter 11 - Promises, under Node.js Rejection Handling
let rejected; process.on("unhandledRejection", function(reason, promise) { console.log(reason.message); // "Explosion!" console.log(rejected === promise); // true }); rejected = Promise.reject(new Error("Explosion!"));
Problem
This example creates a rejected promise with an error object and listens for the unhandledRejection event.
unhandledRejection
Reason It is not clear that the error object is the promise value
Solution
This example creates a rejected promise with an error object as its value and listens for the unhandledRejection event.
Where Chapter 11 - Promises, under Node.js Rejection Handling
Problem
Reason It is not clear that the error object is the promise value
Solution