Potential typo in 11 - Promises - Node.js Rejection Handling
ronen-e opened this issue · comments
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.
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.