docs.rodeo

MDN Web Docs mirror

PromiseRejectionEvent

{{APIRef("HTML DOM")}} {{AvailableInWorkers}} 

The PromiseRejectionEvent interface represents events which are sent to the global script context when JavaScript {{jsxref("Promise")}} s are rejected. These events are particularly useful for telemetry and debugging purposes.

For details, see Promise rejection events.

{{InheritanceDiagram}} 

Constructor

Instance properties

Also inherits properties from its parent {{domxref("Event")}} .

Instance methods

This interface has no unique methods; inherits methods from its parent {{domxref("Event")}} .

Events

Examples

This simple example catches unhandled promise rejections and logs them for debugging purposes.

window.onunhandledrejection = (e) => {
  console.log(e.reason);
};

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN