files/en-us/web/api/promiserejectionevent/index.md
{{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}}
PromiseRejectionEvent event, given the type of event (unhandledrejection or rejectionhandled) and other details.Also inherits properties from its parent {{domxref("Event")}}.
This interface has no unique methods; inherits methods from its parent {{domxref("Event")}}.
This simple example catches unhandled promise rejections and logs them for debugging purposes.
window.onunhandledrejection = (e) => {
console.log(e.reason);
};
{{Specifications}}
{{Compat}}