Skip to content

Commit

Permalink
Merge pull request #141 from torusresearch/fix/generic-error
Browse files Browse the repository at this point in the history
fix error msg verbosity
  • Loading branch information
chaitanyapotti authored May 9, 2024
2 parents 3a8c1a0 + ee53596 commit 941e3fd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/some.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,21 @@ export class SomeError<T> extends Error {
predicate: string;

constructor({ errors, responses, predicate }: { errors: Error[]; responses: T[]; predicate: string }) {
super("Unable to resolve enough promises.");
const message = `Unable to resolve enough promises.
errors: ${errors.map((x) => x?.message || x).join(", ")},
${responses.length} responses,
predicate error: ${predicate}`;
super(message);
this.errors = errors;
this.responses = responses;
this.predicate = predicate;
}

get message() {
return `${super.message}. ${this.errors.length} errors: ${this.errors.map((x) => x.message || x).join(", ")} and ${
return `${super.message}. errors: ${this.errors.map((x) => x?.message || x).join(", ")} and ${
this.responses.length
} responses: ${JSON.stringify(this.responses)}`;
} responses: ${JSON.stringify(this.responses)},
predicate error: ${this.predicate}`;
}

toString() {
Expand Down

0 comments on commit 941e3fd

Please sign in to comment.