GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • MDN
  • HTML: Markup language
  • Elements
  • Global attributes
  • Attributes
  • See all…
  • Responsive images
  • HTML cheatsheet
  • Date & time formats
  • See all…
  • SVG
  • MathML
  • XML
  • CSS: Styling language

This view

  • Original page
  • New address

GeezerVison is showing developer.mozilla.org — Window: rejectionhandled event - Web APIs | MDN

Window: rejectionhandled event

The rejectionhandled event is sent to the script's global scope (usually window but also Worker) whenever a rejected JavaScript 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.

Syntax

Use the event name in addEventListener():

js
addEventListener("rejectionhandled", (event) => { })

Alternatively, assign to the event handler property of the interface:

js
onrejectionhandled = (event) => { }

Event type

A PromiseRejectionEvent. Inherits from Event.

Event handler aliases

In addition to the Window interface, the event handler property onrejectionhandled is also available on the following targets:

  • HTMLBodyElement
  • HTMLFrameSetElement
  • SVGSVGElement

Example

You can use the rejectionhandled event to log promises that get rejected to the console, along with the reasons why they were rejected:

js
window.addEventListener("rejectionhandled", (event) => {
  console.log(`Promise rejected; reason: ${event.reason}`);
});

Specifications

Specification
HTML
# unhandled-promise-rejections
HTML
# handler-window-onrejectionhandled

Browser compatibility

See also

  • Promise rejection events
  • PromiseRejectionEvent
  • Promise
  • unhandledrejection

Help improve MDN

Learn how to contribute

This page was last modified on Oct 26, 2026 by MDN contributors.

View this page on GitHub • Report a problem with this content
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.