mirror of
https://github.com/denoland/deno.git
synced 2024-11-29 16:30:56 -05:00
a87be28a46
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 <nayeemrmn99@gmail.com>
18 lines
442 B
TypeScript
18 lines
442 B
TypeScript
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;
|