DOMException and PromiseRejectionEvent are globals and follow the
WebIDL and
HTML standards, including legacy
DOMException codes and constants such as DOMException.ABORT_ERR.
Promise rejection events
Elide dispatches unhandledrejection on globalThis when a Promise rejects without a handler, and
rejectionhandled when a handler is attached later. onunhandledrejection and onrejectionhandled also work.
globalThis.addEventListener("unhandledrejection", (event) => console.error(event.reason));