diff --git a/.changeset/popular-mails-jam.md b/.changeset/popular-mails-jam.md new file mode 100644 index 00000000000..7fce08dcca2 --- /dev/null +++ b/.changeset/popular-mails-jam.md @@ -0,0 +1,5 @@ +--- +'@clerk/shared': patch +--- + +Updates error handling check within isEmailLinkError to fix issue where email link errors were not properly returning true. diff --git a/packages/shared/src/error.ts b/packages/shared/src/error.ts index 3720811d228..7b58b9fa46a 100644 --- a/packages/shared/src/error.ts +++ b/packages/shared/src/error.ts @@ -201,12 +201,13 @@ export class EmailLinkError extends Error { constructor(code: string) { super(code); this.code = code; + this.name = 'EmailLinkError' as const; Object.setPrototypeOf(this, EmailLinkError.prototype); } } export function isEmailLinkError(err: Error): err is EmailLinkError { - return err instanceof EmailLinkError; + return err.name === 'EmailLinkError'; } export const EmailLinkErrorCode = {