From a87be28a46b67e53354f8ce69386057ddbb0f46c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sat, 16 Apr 2022 16:12:26 +0200 Subject: feat: Better formatting for AggregateError (#14285) This commit adds "aggregated" field to "deno_core::JsError" that stores instances of "JsError" recursively to properly handle "AggregateError" formatting. Appropriate logics was added to "PrettyJsError" and "console" API to format AggregateErrors. Co-authored-by: Nayeem Rahman --- cli/tests/testdata/complex_error.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 cli/tests/testdata/complex_error.ts (limited to 'cli/tests/testdata/complex_error.ts') diff --git a/cli/tests/testdata/complex_error.ts b/cli/tests/testdata/complex_error.ts new file mode 100644 index 000000000..b462992ac --- /dev/null +++ b/cli/tests/testdata/complex_error.ts @@ -0,0 +1,18 @@ +const error = new AggregateError( + [ + new AggregateError([new Error("qux1"), new Error("quux1")]), + new Error("bar1", { cause: new Error("baz1") }), + ], + "foo1", + { + cause: new AggregateError([ + new AggregateError([new Error("qux2"), new Error("quux2")]), + new Error("bar2", { cause: new Error("baz2") }), + ], "foo2"), + }, +); +console.log(error.stack); +console.log(); +console.log(error); +console.log(); +throw error; -- cgit v1.2.3