window.addEventListener("unhandledrejection", (event) => {
console.warn(`UNHANDLED PROMISE REJECTION: ${event.reason}`);
});Window: unhandledrejection event / notebook
Window: unhandledrejection event
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
window.onunhandledrejection = (event) => {
console.warn(`UNHANDLED PROMISE REJECTION: ${event.reason}`);
};window.addEventListener("unhandledrejection", (event) => {
// code for handling the unhandled rejection
// …
// Prevent the default handling (such as outputting the
// error to the console)
event.preventDefault();
});