Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/orange-pandas-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/shared": patch
---

Remove internal tag from publicly re-exported error helpers
10 changes: 0 additions & 10 deletions packages/shared/src/errors/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,35 +80,27 @@ export function isNetworkError(e: any): boolean {

/**
* Checks if the provided error is either a ClerkAPIResponseError, a ClerkRuntimeError, or a MetamaskError.
*
* @internal
*/
export function isKnownError(error: any): error is ClerkAPIResponseError | ClerkRuntimeError | MetamaskError {
return isClerkAPIResponseError(error) || isMetamaskError(error) || isClerkRuntimeError(error);
}

/**
* Checks if the provided error is a Clerk runtime error indicating a reverification was cancelled.
*
* @internal
*/
export function isReverificationCancelledError(err: any) {
return isClerkRuntimeError(err) && err.code === 'reverification_cancelled';
}

/**
* Checks if the provided error is a Metamask error.
*
* @internal
*/
export function isMetamaskError(err: any): err is MetamaskError {
return 'code' in err && [4001, 32602, 32603].includes(err.code) && 'message' in err;
}

/**
* Checks if the provided error is clerk api response error indicating a user is locked.
*
* @internal
*/
export function isUserLockedError(err: any) {
return isClerkAPIResponseError(err) && err.errors?.[0]?.code === 'user_locked';
Expand All @@ -134,8 +126,6 @@ export function isPasswordCompromisedError(err: any) {

/**
* Checks if the provided error is an EmailLinkError.
*
* @internal
*/
export function isEmailLinkError(err: Error): err is EmailLinkError {
return err.name === 'EmailLinkError';
Expand Down
Loading