-
Notifications
You must be signed in to change notification settings - Fork 491
feat(frontend): match sdk error types casing #4057
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
base: master
Are you sure you want to change the base?
feat(frontend): match sdk error types casing #4057
Conversation
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.
unfortunately this would be a breaking changes for a lot of customers
Indeed. We could do our "normal" deprecation pattern.
|
f519537
to
87a5092
Compare
@khaliqgant and @bodinsamuel , I suppose there's no way to deprecate individual string literals within a union type for |
packages/frontend/lib/index.ts
Outdated
legacy?: AuthError; | ||
type: AuthErrorTypeV2; | ||
|
||
constructor(message: string, type: AuthErrorTypeV2, legacyType?: AuthErrorType) { |
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.
a simpler API would be in my opinion to no pass the legacyType and internally map the AuthErrorTypeV2 to the legacy one (since the legacy one are not gonna evolve anymore). wdyt?
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.
Deprecated doesn't raise any alarm in typescript so I wouldn't use that as a safety net. Not entirely sure what does AuthErrorV2
bring since it's still not retro-compatible and still breaking.
If we really want to achieve this, I only see two options:
- opt-in for new errors and have the two system running together
- announce breaking change and just go with it
I would just go for later if that's an accepted risk. So maybe your first option was fine but I'm still not sure why we bother tbh
Tegarding enum I would try not to use them more, since even Microsoft acknowledge they are not good. The only annoying part is @deprecated
but you can use a regular object or constant playground
|
I understand the new class it's just that it's a breaking change, so there is no need to introduce a new layer if it's also breaking.
If you want to upgrade without breaking change you need to do the opposite, by no changing type and introducing a new type class AuthError {
type,
typeV2
} But if you do that, that nobody will upgrade since no TS errors will be raised. So that's why I'm saying, maybe the only way is just to create a breaking change and be done with it. |
4f6c19d
to
0490112
Compare
Aaah, that makes perfect sense, thanks! I think going for it with the breaking changes is the only way. I've reverted to the initial commit of the PR. |
what's the plan to release this breaking change? |
##Describe the problem and your solution
This PR updates all frontend SDK authentication error type string literals and related documentation from camelCase (e.g., 'missingAuthToken') to snake_case (e.g., 'missing_auth_token') to match industry convention. Changes are made to type definitions, error construction logic, UI error handling, and the SDK reference documentation for consistency and future extensibility.
Key Changes:
• Replaced all camelCase AuthErrorType values with snake_case equivalents in 'packages/frontend/lib/types.ts' and corresponding usage throughout the frontend SDK.
• Updated error instantiation locations and error handling logic to use new snake_case error codes.
• Aligned UI error presentation in Connect UI to expect new error type casing ('window_closed', etc.).
• Revised reference documentation (docs-v2/reference/sdks/frontend.mdx) to match new error codes and descriptions.
Affected Areas:
• Frontend SDK type definitions and error handling ('packages/frontend/lib/types.ts', 'packages/frontend/lib/index.ts')
• Connect UI error display logic ('packages/connect-ui/src/views/Go.tsx')
• Frontend SDK documentation ('docs-v2/reference/sdks/frontend.mdx')
This summary was automatically generated by @propel-code-bot