Skip to content

Commit 6126cc9

Browse files
fix(shared): Update isEmailLinkError check to look for err name (#4963)
1 parent 3c6d815 commit 6126cc9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/popular-mails-jam.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/shared': patch
3+
---
4+
5+
Updates error handling check within isEmailLinkError to fix issue where email link errors were not properly returning true.

packages/shared/src/error.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,13 @@ export class EmailLinkError extends Error {
201201
constructor(code: string) {
202202
super(code);
203203
this.code = code;
204+
this.name = 'EmailLinkError' as const;
204205
Object.setPrototypeOf(this, EmailLinkError.prototype);
205206
}
206207
}
207208

208209
export function isEmailLinkError(err: Error): err is EmailLinkError {
209-
return err instanceof EmailLinkError;
210+
return err.name === 'EmailLinkError';
210211
}
211212

212213
export const EmailLinkErrorCode = {

0 commit comments

Comments
 (0)