-
Notifications
You must be signed in to change notification settings - Fork 436
refactor(shared,upgrade): Update exported error typeguard functions from error.ts, port from core 2 #7509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
refactor(shared,upgrade): Update exported error typeguard functions from error.ts, port from core 2 #7509
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d6e8f32
refactor(shared): Update exported error typeguard functions from erro…
kduprey 74aacfd
fix(errors): Update ClerkAPIError.kind to match class name and add co…
kduprey 696ea44
chore: pnpm changeset
kduprey 2f4b27d
Merge branch 'main' into kenton/port-7490-to-core-3
kduprey 2ac8198
fix(errors): Enhance type guard to handle cross-bundle scenarios with…
kduprey 1cd4eb5
Merge branch 'main' into kenton/port-7490-to-core-3
kduprey f901bfc
Merge branch 'main' into kenton/port-7490-to-core-3
kduprey b4ad421
fix(errors): Correct casing of 'ClerkAPIResponseError' in error handling
kduprey 233d6a1
Merge branch 'main' into kenton/port-7490-to-core-3
kduprey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
| --- | ||
| '@clerk/shared': patch | ||
| --- | ||
|
|
||
| Refactor internal Clerk error handling functions |
This file contains hidden or 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': major | ||
| '@clerk/upgrade': minor | ||
| --- | ||
|
|
||
| Update `ClerkAPIError.kind` value to match class name |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
17 changes: 17 additions & 0 deletions
17
packages/upgrade/src/versions/core-3/changes/clerk-api-error-kind-added.md
This file contains hidden or 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,17 @@ | ||
| --- | ||
| title: '`ClerkAPIError.kind` value updated' | ||
| matcher: 'ClerkApiError' | ||
| category: 'behavior-change' | ||
| warning: true | ||
| --- | ||
|
|
||
| `ClerkAPIError.kind` has been updated to match the class name: | ||
|
|
||
| ```diff | ||
| - static kind = 'ClerkApiError' | ||
| + static kind = 'ClerkAPIError' | ||
| ``` | ||
|
|
||
| Most users should not be affected. If you were checking this string directly (for example, `error.constructor.kind === 'ClerkApiError'`), update the comparison value. | ||
|
|
||
| No other changes are required. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Duck-typing check allows non-Error objects to pass type guard.
The duck-typing check only validates
constructor.kindwithout verifying the target is an actual Error instance. This allows any plain object with a matchingconstructor.kindproperty to pass:This violates the type guard's promise that
error is InstanceType<T>and can cause runtime errors when code expects actual Error properties/methods.🔎 Proposed fix to validate Error instance first
🤖 Prompt for AI Agents