Firefox Tomorrow

web api instance property

PromiseRejectionEvent: reason property

View on MDN ↗

Available in workers

The PromiseRejectionEvent reason read-only property is any JavaScript value or Object which provides the reason passed into reject(). This in theory provides information about why the promise was rejected.

Value

A value or object which provides information you can use to understand why the promise was rejected. This could be anything from an error code to an object with text, links, and whatever else you might wish to include.

Examples

window.onunhandledrejection = (e) => {
  console.log(e.reason);
};

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also