Note: This feature is available in Web Workers.
The PromiseRejectionEvent reason read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject(). This in theory provides information about why the promise was rejected.
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.
window.onunhandledrejection = (e) => {
console.log(e.reason);
};
| Specification |
|---|
| HTML> # dom-promiserejectionevent-reason> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
reason |
49 | 79 | 69 | 36 | 11 | 49 | 79 | 36 | 11.3 | 5.0 | 49 | 11.3 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent/reason