feat(clerk-js,shared,types): Add ClerkRuntimeError class#1813
feat(clerk-js,shared,types): Add ClerkRuntimeError class#1813panteliselef merged 1 commit intomainfrom
Conversation
🦋 Changeset detectedLatest commit: 00228d4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| }; | ||
| } | ||
|
|
||
| export class ClerkRuntimeError extends Error { |
There was a problem hiding this comment.
Given that we are adding new exports here, can we add JSDoc comments above isClerkRuntimeError and ClerkRuntimeError briefly explaining intended usage?
dimkl
left a comment
There was a problem hiding this comment.
❓ Instead of introducing a new error class, couldn't we add the code to our existing error classes (if exists) and use a helper isTranslatableError(error) that will check if the code exists in the supported localization keys to translate the error?
I left some questions in the PR but i will approve this since I may be missing some context.
With the introduction of this class, we can localize error messages and display them in ClerkJS components. This functionality existed for FAPI errors, and we are now adding support for runtime errors.
|
This PR has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
With the introduction of ClerkRuntimeError class, we can localize error messages and display them in ClerkJS components. This functionality existed for FAPI errors, and we are now adding support for runtime errors.
Example
Displays an error message caused when lazy loading a 3rd party library. In this case, the sign up process cannot continue and we need to provided the end user with some feedback.

Checklist
npm testruns as expected.npm run buildruns as expected.Type of change
Packages affected
@clerk/clerk-js@clerk/clerk-react@clerk/nextjs@clerk/remix@clerk/types@clerk/themes@clerk/localizations@clerk/clerk-expo@clerk/backend@clerk/clerk-sdk-node@clerk/shared@clerk/fastify@clerk/chrome-extensiongatsby-plugin-clerkbuild/tooling/chore