Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use BaseError instead of Error
  • Loading branch information
kailash-b committed Feb 18, 2025
commit 4ebe3c08f2512154465122ca020edf29b587fa4e
3 changes: 2 additions & 1 deletion src/hooks/auth0-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
RevokeOptions,
ResetPasswordOptions,
} from '../types';
import BaseError from 'src/utils/baseError';

export interface Auth0ContextInterface<TUser extends User = User>
extends AuthState<TUser> {
Expand Down Expand Up @@ -143,7 +144,7 @@ export interface AuthState<TUser extends User = User> {
/**
* An object representing the last exception
*/
error: Error | null;
error: BaseError | null;
/**
* The user profile as decoded from the ID token after authentication
*/
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/reducer.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import BaseError from 'src/utils/baseError';
import { User } from '../types';
import { deepEqual } from '../utils/deepEqual';
import { AuthState } from './auth0-context';

type Action =
| { type: 'LOGIN_COMPLETE'; user: User }
| { type: 'LOGOUT_COMPLETE' }
| { type: 'ERROR'; error: Error }
| { type: 'ERROR'; error: BaseError }
Copy link
Contributor

Choose a reason for hiding this comment

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

What value do we provide to generic_error_code if for authentication errors.

Copy link
Contributor Author

@kailash-b kailash-b Feb 18, 2025

Choose a reason for hiding this comment

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

It is left empty.
The field is currently populated only in case of a CredentialManagerException.
We can re-use this field when we collate the Authentication Errors as well (tracked as part of SDK-5700).

| { type: 'INITIALIZED'; user: User | null }
| { type: 'SET_USER'; user: User };

Expand Down