| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/rejectionhandled_event | [Back] [Original] |
Get to know MDN better
This feature is well established and works across many devices and browser versions. Its been available across browsers since July 2020.
Note: This feature is only available in Web Workers.
The rejectionhandled event is sent to the script's global scope (typically WorkerGlobalScope) whenever a rejected Promise is handled late, i.e., when a handler is attached to the promise after its rejection had caused an unhandledrejection event.
This can be used in debugging and for general application resiliency, in tandem with the unhandledrejection event, which is sent when a promise is rejected but there is no handler for the rejection at the time.
Use the event name in methods like addEventListener(), or set an event handler property.
addEventListener("rejectionhandled", (event) => { })
onrejectionhandled = (event) => { }
A PromiseRejectionEvent. Inherits from Event.
You can use the rejectionhandled event to log promises that get rejected to the console, along with the reasons why they were rejected:
self.addEventListener("rejectionhandled", (event) => {
console.log(`Promise rejected; reason: ${event.reason}`);
});
| Specification |
|---|
| HTML # handler-workerglobalscope-onrejectionhandled |
This page was last modified on Jul 28, 2026 by MDN contributors.
WorkerGlobalScopeAbortControllerAbortSignalAbstractRangeAttrCDATASectionCharacterDataCommentCustomEventDOMErrorDOMExceptionDOMImplementationDOMParserDOMTokenListDocumentDocumentFragmentDocumentTypeElementEventEventTargetHTMLCollectionMutationObserverMutationRecordNamedNodeMapNodeNodeIteratorNodeListProcessingInstructionQuotaExceededErrorRangeShadowRootStaticRangeTextTreeWalkerXMLDocumentXPathEvaluatorXPathExpressionXPathResultXSLTProcessorYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |