Skip to content

Conversation

hugoecken
Copy link

@hugoecken hugoecken commented Oct 8, 2025

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 error type values across the SDK.

  • Updated ERROR_CODE_MAP in WebAuthError and CredentialsManagerError to reference the new constants instead of hardcoded strings.

Why this is important:

  • This change provides a consistent and type-safe way for SDK users to reference error codes directly from constants.
  • Enables IntelliSense / autocompletion for error codes (WebAuthErrorCodes.<CODE>, CredentialsManagerErrorCodes.<CODE>, AuthErrorCodes.<CODE>).
  • Reduces the risk of typos and simplifies code maintenance.
  • Does not introduce breaking changes — all existing logic and error handling remain identical.

Classes and methods changed:

  • WebAuthError: no behavioral change, internal ERROR_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

  • This change improves developer experience when consuming SDK error types.
  • Inspired by patterns used in other Auth0 SDKs (Web, SPA, and Swift).
  • No external support tickets or issues were required for this improvement — this is an internal developer experience enhancement.

Testing

How reviewers can test:

  1. Run the existing unit test suite — no tests should fail.

  2. Verify that WebAuthError and CredentialsManagerError still behave as expected (types and mappings).

  3. Import and use the new constants in a test or sample app:

    import { AuthErrorCodes } from '../src/models/AuthError';
    
    if (error.type === AuthErrorCodes.NO_CREDENTIALS) {
      ...
    }
  4. 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

@hugoecken hugoecken requested a review from a team as a code owner October 8, 2025 13:01
@subhankarmaiti
Copy link
Contributor

@claude

Copy link

github-actions bot commented Oct 8, 2025

Claude encountered an error —— View job

Failed with exit code 128

I'll analyze this and get back to you.

@Noitham
Copy link

Noitham commented Oct 9, 2025

This is good 🚀

Copy link
Contributor

@subhankarmaiti subhankarmaiti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, please run yarn lint and fix the linting issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants