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