feat: add error code constants for WebAuth and CredentialsManager #1340
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.
Changes
Summary of changes:
Added two new public constants:
WebAuthErrorCodes
CredentialsManagerErrorCodes
Added a combined constant
AuthErrorCodes
that merges both sets of codes.Added a corresponding union type
AuthErrorCode
for all possible errortype
values across the SDK.Updated
ERROR_CODE_MAP
inWebAuthError
andCredentialsManagerError
to reference the new constants instead of hardcoded strings.Why this is important:
WebAuthErrorCodes.<CODE>
,CredentialsManagerErrorCodes.<CODE>
,AuthErrorCodes.<CODE>
).Classes and methods changed:
WebAuthError
: no behavioral change, internalERROR_CODE_MAP
now uses constants.CredentialsManagerError
: same as above.AuthError
: new exports added (AuthErrorCodes
,AuthErrorCode
).No endpoints or UI are affected by this change.
References
Testing
How reviewers can test:
Run the existing unit test suite — no tests should fail.
Verify that
WebAuthError
andCredentialsManagerError
still behave as expected (types and mappings).Import and use the new constants in a test or sample app:
Confirm TypeScript autocompletion works for:
WebAuthErrorCodes.<CODE>
CredentialsManagerErrorCodes.<CODE>
AuthErrorCodes.<CODE>
Testing notes:
No new runtime behavior introduced.
This change affects type definitions and internal mappings only.
No new dependencies or API calls added.
This change adds unit test coverage (optional enhancement for type-based validation can be added later).
This change has been tested locally on the latest React Native SDK setup.
Checklist