Understand Promise.resolve() with Function Values

Promise.resolve() treats a function like any other value. It does not call the function. If you need to run a callback and convert either a synchronous exception or an asynchronous rejection into a rejected promise, use Promise.try() where supported.

Last updated: November 15, 2026.

function loadValue() {
  throw new Error('Could not load the value');
}

// Fulfilled with the function object; loadValue is not called.
Promise.resolve(loadValue).then(value => {
  console.log(value === loadValue); // true
});

// Calls loadValue and converts its thrown error to a rejection.
Promise.try(loadValue).catch(error => {
  console.error(error.message); // Could not load the value
});

The parentheses matter. Promise.resolve(loadValue()) calls the function before Promise.resolve runs, so a synchronous exception escapes immediately. Promise.try(loadValue) performs the call inside the promise operation.

Know what Promise.resolve actually inspects

The MDN Promise.resolve reference says the returned promise adopts a native promise or thenable. A normal function is neither unless it also exposes a callable then property, so the function becomes the fulfillment value unchanged.

If the argument is a thenable, its then method is called and the returned promise adopts its eventual state. This behavior is about the value passed to Promise.resolve; it is not a general-purpose callback runner.

Choose a compatible callback wrapper

The MDN Promise.try reference describes a callback wrapper that handles synchronous return values, thrown exceptions, and returned promises uniformly. Check runtime support before using it. For older runtimes, Promise.resolve().then(loadValue) also converts a thrown error to a rejection, but it always schedules the callback asynchronously. An async function with try...catch is often the clearest option when exact call timing is not part of the API contract.

Test all three callback outcomes: a plain value, a synchronous throw, and a rejected promise. Do not add an empty catch; either handle the failure or return the rejection to the caller.

Related Web Cheat Sheet guides

Sergey Kornilov

Sergey Kornilov