Skip to content

Commit ad09f50

Browse files
committed
feat(connect): define TrezorError.toString with pertinent info
1 parent fb496b7 commit ad09f50

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/connect/src/constants/errors.ts

+5
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ export class TrezorError extends Error {
6969
this.code = code;
7070
this.message = message;
7171
}
72+
73+
// Error.prototype.toString() does not include custom property `code`
74+
toString() {
75+
return `${this.name} (code: ${this.code}): ${this.message}`;
76+
}
7277
}
7378

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

0 commit comments

Comments
 (0)