variable onunhandledrejection
Event handler for unhandled promise rejections.
Triggered when a Promise
is rejected and no rejection handler is attached to it.
Examples #
#
onunhandledrejection = (event) => {
console.log("Unhandled rejection:", event.reason);
event.preventDefault(); // Prevents the default handling
};
// This will trigger the event handler
Promise.reject(new Error("Example error"));
Type #
((this: Window,) => any) | null