From 5083f5fd908057cbc8649b79c13ab78a7f7ebf34 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Mon, 29 Jul 2019 19:11:08 +1000 Subject: Remap stack traces of unthrown errors. (#2693) --- tests/error_stack.test | 4 ++++ tests/error_stack.ts | 10 ++++++++++ tests/error_stack.ts.out | 6 ++++++ 3 files changed, 20 insertions(+) create mode 100644 tests/error_stack.test create mode 100644 tests/error_stack.ts create mode 100644 tests/error_stack.ts.out (limited to 'tests') diff --git a/tests/error_stack.test b/tests/error_stack.test new file mode 100644 index 000000000..88de56958 --- /dev/null +++ b/tests/error_stack.test @@ -0,0 +1,4 @@ +args: run --reload tests/error_stack.ts +check_stderr: true +exit_code: 1 +output: tests/error_stack.ts.out diff --git a/tests/error_stack.ts b/tests/error_stack.ts new file mode 100644 index 000000000..f2125d662 --- /dev/null +++ b/tests/error_stack.ts @@ -0,0 +1,10 @@ +function foo(): never { + throw new Error("foo"); +} + +try { + foo(); +} catch (e) { + console.log(e); + throw e; +} diff --git a/tests/error_stack.ts.out b/tests/error_stack.ts.out new file mode 100644 index 000000000..2bb629e2d --- /dev/null +++ b/tests/error_stack.ts.out @@ -0,0 +1,6 @@ +[WILDCARD]Error: foo + at foo ([WILDCARD]tests/error_stack.ts:2:9) + at [WILDCARD]tests/error_stack.ts:6:3 +error: Uncaught Error: foo + at foo ([WILDCARD]tests/error_stack.ts:2:9) + at [WILDCARD]tests/error_stack.ts:6:3 -- cgit v1.2.3