"Fossies" - the Fresh Open Source Software Archive

Member "deno-1.34.2/cli/tests/testdata/run/018_async_catch.ts" (9 Jun 2023, 322 Bytes) of package /linux/www/deno-1.34.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 function fn(): Promise<never> {
    2   throw new Error("message");
    3 }
    4 async function call() {
    5   try {
    6     console.log("before await fn()");
    7     await fn();
    8     console.log("after await fn()");
    9   } catch (_error) {
   10     console.log("catch");
   11   }
   12   console.log("after try-catch");
   13 }
   14 call().catch(() => console.log("outer catch"));