Skip to main content
Version: 3.13.0

Promise.reject()

The Promise.reject() method returns a Promise object that is rejected with a given reason.

Syntax

Promise.reject(reason)

Parameters

  • reason
    • : Reason why this Promise rejected.

Return value

A Promise that is rejected with the given reason.

Description

The static Promise.reject function returns a Promise that is rejected. For debugging purposes and selective error catching, it is useful to make reason an instanceof Error.

Promise.reject() is generic and supports subclassing, which means it can be called on subclasses of Promise, and the result will be a promise of the subclass type. To do so, the subclass's constructor must implement the same signature as the Promise() constructor — accepting a single executor function that can be called with the resolve and reject callbacks as parameters. Promise.reject() is essentially a shorthand for new Promise((resolve, reject) => reject(reason)).

Unlike Promise.resolve(), Promise.reject() always wraps reason in a new Promise object, even when reason is already a Promise.