Skip to content

Commit c5552d8

Browse files
committed
feat(authentication): update state to use exception object
Refactors `AuthenticationState` to replace the `errorMessage` string with a `HtHttpException` object named `exception`. This change is necessary to support the new `ht_ui_kit` package, which provides a `toFriendlyMessage` extension on `HtHttpException` for displaying localized error messages. Storing the full exception object in the state allows the UI layer to access it directly and use the extension, ensuring consistent and localized error handling.
1 parent 7ce06ee commit c5552d8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/authentication/bloc/authentication_state.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ final class AuthenticationState extends Equatable {
3535
this.status = AuthenticationStatus.initial,
3636
this.user,
3737
this.email,
38-
this.errorMessage,
38+
this.exception,
3939
});
4040

4141
/// The current status of the authentication process.
@@ -47,25 +47,25 @@ final class AuthenticationState extends Equatable {
4747
/// The email address involved in the current authentication flow.
4848
final String? email;
4949

50-
/// The error message describing an authentication failure, if any.
51-
final String? errorMessage;
50+
/// The error describing an authentication failure, if any.
51+
final HtHttpException? exception;
5252

5353
@override
54-
List<Object?> get props => [status, user, email, errorMessage];
54+
List<Object?> get props => [status, user, email, exception];
5555

5656
/// Creates a copy of this [AuthenticationState] with the given fields
5757
/// replaced with the new values.
5858
AuthenticationState copyWith({
5959
AuthenticationStatus? status,
6060
User? user,
6161
String? email,
62-
String? errorMessage,
62+
HtHttpException? exception,
6363
}) {
6464
return AuthenticationState(
6565
status: status ?? this.status,
6666
user: user ?? this.user,
6767
email: email ?? this.email,
68-
errorMessage: errorMessage ?? this.errorMessage,
68+
exception: exception ?? this.exception,
6969
);
7070
}
7171
}

0 commit comments

Comments
 (0)