Skip to content

Commit

Permalink
Fix parallel aggregate error hiding real stacktrace (#164)
Browse files Browse the repository at this point in the history
* fix parallel aggregate error having unhelpful stacktrace
  • Loading branch information
sodiray authored Nov 23, 2022
1 parent 7aa63b7 commit ed21a8b
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 7 deletions.
6 changes: 5 additions & 1 deletion cdn/radash.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,12 @@ const defer = async (func) => {
return response;
};
class AggregateError extends Error {
constructor(errors) {
constructor(errors = []) {
super();
const name = errors.find((e) => e.name)?.name ?? "";
this.name = `AggregateError(${name}...)`;
this.message = `AggregateError with ${errors.length} errors`;
this.stack = errors.find((e) => e.stack)?.stack ?? this.stack;
this.errors = errors;
}
}
Expand Down
6 changes: 5 additions & 1 deletion cdn/radash.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,12 @@ var radash = (function (exports) {
return response;
};
class AggregateError extends Error {
constructor(errors) {
constructor(errors = []) {
super();
const name = errors.find((e) => e.name)?.name ?? "";
this.name = `AggregateError(${name}...)`;
this.message = `AggregateError with ${errors.length} errors`;
this.stack = errors.find((e) => e.stack)?.stack ?? this.stack;
this.errors = errors;
}
}
Expand Down
2 changes: 1 addition & 1 deletion cdn/radash.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ed21a8b

Please sign in to comment.