Nuestros voluntarios aún no han traducido este artículo al Español. ¡Únete a nosotros y ayúdanos a traducirlo!
También puedes leer el artículo en English (US).
The PromiseRejectionEvent
interface represents events which are fired when JavaScript Promise
s are rejected. These events are particularly useful for telemetry and debugging purposes.
Constructor
PromiseRejectionEvent()
- Creates a
PromiseRejectionEvent
event with the given parameters.
Properties
Also inherits properties from its parent Event
.
PromiseRejectionEvent.promise
Read only- The JavaScript
Promise
that was rejected. PromiseRejectionEvent.reason
Read only- A value or
Object
indicating why the promise was rejected, as passed toPromise.reject()
.
Methods
This interface has no unique methods; inherits methods from its parent Event
.
Events
unhandledrejection
- Fired when a JavaScript
Promise
is rejected but there is no rejection handler to deal with the rejection. rejectionhandled
- Fired when a JavaScript
Promise
is rejected, and after the rejection is handled by the promise's rejection handling code.
Examples
window.onunhandledrejection = function(e) { console.log(e.reason); }
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'PromiseRejectionEvent' in that specification. |
Living Standard | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Basic support | Chrome Full support 49 | Edge ? | Firefox
No support
No
| IE No support No | Opera No support No | Safari No support No | WebView Android ? | Chrome Android No support No | Edge Mobile ? | Firefox Android
No support
No
| Opera Android No support No | Safari iOS No support No | Samsung Internet Android ? |
PromiseRejectionEvent | Chrome Full support 49 | Edge ? | Firefox
No support
No
| IE No support No | Opera No support No | Safari No support No | WebView Android ? | Chrome Android No support No | Edge Mobile ? | Firefox Android
No support
No
| Opera Android No support No | Safari iOS No support No | Samsung Internet Android ? |
promise | Chrome Full support 49 | Edge ? | Firefox
No support
No
| IE No support No | Opera No support No | Safari No support No | WebView Android ? | Chrome Android No support No | Edge Mobile ? | Firefox Android
No support
No
| Opera Android No support No | Safari iOS No support No | Samsung Internet Android ? |
reason | Chrome Full support 49 | Edge ? | Firefox
No support
No
| IE No support No | Opera No support No | Safari No support No | WebView Android ? | Chrome Android No support No | Edge Mobile ? | Firefox Android
No support
No
| Opera Android No support No | Safari iOS No support No | Samsung Internet Android ? |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- See implementation notes.
- See implementation notes.
- User must explicitly enable this feature.
- User must explicitly enable this feature.