Skip to content

Commit

Permalink
feat(connect): define TrezorError.toString with pertinent info
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemonexe committed Jan 28, 2025
1 parent 77f895b commit bc60a9a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/connect/src/constants/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ export class TrezorError extends Error {
this.code = code;
this.message = message;
}

// Error.prototype.toString() does not include custom property `code`
toString() {
return `${this.name} (code: ${this.code}): ${this.message}`;
}
}

export const TypedError = (id: ErrorCode, message?: string) =>
Expand Down

0 comments on commit bc60a9a

Please sign in to comment.