liveBook · Manning

Rejected state

The rejected state is a Promise state indicating that an asynchronous operation failed and carries a rejection reason rather than a fulfillment value.

How 2 Manning books explain it

Secrets of the JavaScript Ninja, Third Edition

The rejected state is a promise state indicating that the asynchronous operation failed with a rejection reason.

How it is used
Represents asynchronous failure as a settled promise outcome with an associated rejection reason.
How deep it goes
Defines rejection, settlement, and executor transitions, then traces thrown errors through promise chaining and catch handlers.
Examples
Uses reject(reason), executor throws, and a fetch chain that throws on a bad response and handles failure with catch.
What you can do after
Diagnose failures across a fetch chain by routing request, status, and JSON errors to one catch handler.

Read how Secrets of the JavaScript Ninja, Third Edition explains rejected state →

Secrets of the JavaScript Ninja, Second Edition

The promise state indicating unsuccessful completion with a rejection reason.

How it is used
Handles unsuccessful outcomes of asynchronous computations represented by JavaScript promises.
How deep it goes
Defines rejection, explains its triggers, and notes that the state cannot change once reached.
Examples
Uses a Hattori promise with success and failure callbacks, plus an alternate reject call.
What you can do after
Understand when a promise rejects and how its failure callback differs from its success callback.

Read how Secrets of the JavaScript Ninja, Second Edition explains rejected state →

Also covered in

What to know first

Related concepts

Questions about rejected state

What is rejected state?

The rejected state is a Promise state indicating that an asynchronous operation failed and carries a rejection reason rather than a fulfillment value.

Which Manning books explain rejected state?

Secrets of the JavaScript Ninja, Third Edition and Secrets of the JavaScript Ninja, Second Edition.

What should I know before learning rejected state?

Manning books that teach rejected state usually introduce try-catch block first.

What is rejected state a kind of?

Rejected state is a kind of state. State is information describing the condition or configuration of a system or computation at a particular time that may influence its behavior or subsequent transitions.

What is rejected state part of?

Rejected state is part of promise. A JavaScript Promise is an object representing the eventual completion or failure of an asynchronous operation and its resulting value or reason.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.