2024-08-28 19:56:15 -04:00
|
|
|
globalThis.addEventListener("unhandledrejection", (event) => {
|
2024-01-12 17:10:42 -05:00
|
|
|
console.log("unhandledrejection", event.reason, event.promise);
|
|
|
|
event.preventDefault();
|
|
|
|
});
|
|
|
|
|
2024-08-28 19:56:15 -04:00
|
|
|
globalThis.addEventListener("rejectionhandled", (event) => {
|
2024-01-12 17:10:42 -05:00
|
|
|
console.log("rejectionhandled", event.reason, event.promise);
|
|
|
|
});
|
|
|
|
|
|
|
|
const a = Promise.reject(1);
|
|
|
|
setTimeout(async () => {
|
|
|
|
a.catch(() => console.log("Added catch handler to the promise"));
|
|
|
|
}, 10);
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
console.log("Success");
|
2024-04-18 19:40:15 -04:00
|
|
|
}, 1000);
|