PromiseRejectionEvent()

The PromiseRejectionEvent() constructor returns a newly created PromiseRejectionEvent, which represents events fired when a JavaScript Promise is rejected.

Syntax

JavaScript
new PromiseRejectionEvent(type, {
  promise: somePromise, 
  reason : someValue
});

Parameters

The PromiseRejectionEvent() constructor also inherits arguments from Event().

type
A string representing the name of the type of the PromiseRejectionEvent. This is case-sensitive and must be one of "rejectionhandled" or "unhandledrejection".
promise
The Promise which was rejected.
reason
Any value or Object which represents the reason the promise was rejected.

Specifications

Specification Status Comment
WHATWG HTML Living Standard
The definition of 'PromiseRejectionEvent()' in that specification.
Living Standard Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 49 No support No support No support No support
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support No support No support No support No support No support

See also

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/promiserejectionevent/promiserejectionevent

API Constructor events Events HTML DOM JavaScript PromiseRejectionEvent Promises Reference