CKTIS / JavaScript
Promise.reject — creating a rejected promise
Promise.reject(reason) creates a new rejected promise with the supplied reason. Rejection handlers run asynchronously even though the returned promise is already rejected.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
Promise.reject(reason)Promise.reject(reason) is a static method of the Promise constructor. It returns a new promise in the rejected state with reason as its rejection reason. The reason can be any value; omitting the argument uses undefined. For errors, prefer an Error object.
The method does not adopt the state of a supplied promise or an object with a then method (a thenable). That argument itself becomes the rejection reason. Unlike Promise.resolve, Promise.reject does not return a supplied promise unchanged.
An ordinary Promise.reject(reason) call is not a synchronous throw: a surrounding try...catch will not catch the rejection itself. Use .catch(...) or try...catch around await. Promise handlers run only after the current synchronous code finishes. Handle rejections; the response to an unhandled rejection depends on the host environment.
In the example, sync appears before the rejection handler runs, and true confirms that the reason retains its identity. Call the method as Promise.reject(...): its this must be a constructor compatible with the Promise constructor conventions, so a detached call without the correct receiver can throw TypeError.
Examples
const reason = new Error("Invalid input");
const rejected = Promise.reject(reason);
rejected.catch((error) => {
console.log(error === reason);
console.log(error.message);
});
console.log("sync");Result
sync true Invalid input
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.