creation

Promise.reject

Returns a promise that is already rejected with the given reason. Useful for early-exit paths in functions that must always return a promise.

Promise.reject(reason)

Parameters

Parameter Purpose
reason Rejection reason — conventionally an Error instance
no thenable adoption Unlike resolve, reject does NOT unwrap thenables
immediate Handlers fire on the next microtask

Examples

function requireAuth(token) {
  if (!token) return Promise.reject(new Error('missing token'));
  return fetchUser(token);
}

Keeps the return type consistently a promise.

Promise.reject(new Error('nope'))
  .catch(err => console.log(err.message)); // 'nope'

Straightforward rejection captured by .catch.

// Unhandled rejections are dangerous — always .catch
const p = Promise.reject('lost');
// triggers unhandledrejection unless a handler is attached in time

Uncaught rejections fire the unhandledrejection event and may crash Node 15+.

Gotcha

Prefer Error objects over strings for reasons — you lose the stack trace with primitives. Even a rejected promise created for a fast fail path needs a .catch (or an await inside try) somewhere down the line.

Related

← All JS Promise reference · async/await vs promises vs callbacks