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.
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.
js
window.onunhandledrejection = (e) => { console.log(e.reason); };
Specification |
---|
HTML Standard # dom-promiserejectionevent-reason |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
reason |
49 | 79 | 69 | No | 36 | 11 | 49 | 49 | 79 | 36 | 11.3 | 5.0 |
© 2005–2023 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