summaryrefslogtreecommitdiff
path: root/tests/testdata/node/unhandled_rejection_web.ts
blob: 396c58c2a199874ff768623e76c96a3229f586de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import chalk from "npm:chalk";

console.log(chalk.red("Hello world!"));

globalThis.addEventListener("unhandledrejection", (e) => {
  console.log("Handled the promise rejection");
  e.preventDefault();
});

// deno-lint-ignore require-await
(async () => {
  throw new Error("boom!");
})();

setTimeout(() => {
  console.log("Success");
}, 1000);