-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SDK-805] Use the
errorThrower
shared util when throwing errors (#1999
) * refactor(clerk-react): Use the errorThrower shared util when throwing errors * chore(clerk-react): Add changeset * chore(clerk-react): Update packages/react/src/utils/useMaxAllowedInstancesGuard.tsx Co-authored-by: panteliselef <[email protected]> --------- Co-authored-by: panteliselef <[email protected]>
- Loading branch information
1 parent
83562b8
commit e0e79b4
Showing
13 changed files
with
46 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@clerk/shared': patch | ||
'@clerk/clerk-react': patch | ||
--- | ||
|
||
Use the errorThrower shared utility when throwing errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
import { noClerkProviderError, noGuaranteedLoadedError } from '../errors'; | ||
import { errorThrower } from '../utils'; | ||
|
||
export function assertWrappedByClerkProvider(contextVal: unknown): asserts contextVal { | ||
if (!contextVal) { | ||
throw new Error(noClerkProviderError); | ||
errorThrower.throw(noClerkProviderError); | ||
} | ||
} | ||
|
||
export function assertClerkLoadedGuarantee(guarantee: unknown, hookName: string): asserts guarantee { | ||
if (!guarantee) { | ||
throw new Error(noGuaranteedLoadedError(hookName)); | ||
errorThrower.throw(noGuaranteedLoadedError(hookName)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters