Skip to content

Potential typo in 11 - Promises - Node.js Rejection Handling #455

@ronen-e

Description

@ronen-e

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions