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.
Syntax
reason = PromiseRejectionEvent.reason
Examples
window.onunhandledrejection = function(e) { console.log(e.reason); }
Specifications
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of 'PromiseRejectionEvent.reason' in that specification. |
Living Standard | Initial definition. |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 49 | No support[1] | No support | No support | No support |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | No support | No support[1] | No support | No support | No support |
[1] In Firefox, this is implemented but disabled by default. To turn it on, go to about:config and set the dom.promise_rejection_events.enabled
pref to true
.