Skip to content

Commit

Permalink
small fix in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
vkubiv committed Aug 31, 2024
1 parent 32d41f8 commit beb2c9a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ AsyncResult<AuthToken, Errors2<InvalidCredentials, EmailNotConfirmed>> login(Str
success: (r) => AuthToken.parse(r.data),
failure: (e) =>
switch (e) {
(ValidationError e) when e.code == 'email-not-confirmed' => EmailNotConfirmed(),
(Unauthorized) => InvalidCredentials(),
ValidationError e when e.code == 'email-not-confirmed' => EmailNotConfirmed(),
Unauthorized => InvalidCredentials(),
_ => e
});
}
Expand All @@ -64,8 +64,8 @@ AsyncResult<Profile, Errors2<Unauthorized, InvalidFormField>> editProfile(
success: (response) => Profile.fromMap(response.data),
failure: (e) =>
switch (e) {
(Unauthorized e) => e,
(ValidationError e) when e.code == 'incorrect-value' =>
Unauthorized e => e,
ValidationError e when e.code == 'incorrect-value' =>
InvalidFormField(fieldName: e.incorrectValue, message: e.message),
_ => e
},
Expand Down
8 changes: 4 additions & 4 deletions example/operation_result_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ AsyncResult<AuthToken, Errors2<InvalidCredentials, EmailNotConfirmed>> login(Str
return response.forward2(
success: (r) => AuthToken.parse(r.data),
failure: (e) => switch (e) {
(ValidationError e) when e.code == 'email-not-confirmed' => EmailNotConfirmed(),
(Unauthorized _) => InvalidCredentials(),
ValidationError e when e.code == 'email-not-confirmed' => EmailNotConfirmed(),
Unauthorized _ => InvalidCredentials(),
_ => e
});
}
Expand All @@ -38,8 +38,8 @@ AsyncResult<Profile, Errors2<Unauthorized, InvalidFormField>> editProfile(Profil
return response.forward2(
success: (response) => Profile.fromMap(response.data),
failure: (e) => switch (e) {
(Unauthorized e) => e,
(ValidationError e) when e.code == 'incorrect-value' =>
Unauthorized e => e,
ValidationError e when e.code == 'incorrect-value' =>
InvalidFormField(fieldName: e.incorrectValue, message: e.message),
_ => e
},
Expand Down
8 changes: 4 additions & 4 deletions lib/src/operation_result_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class Result<T, Errors extends IExpectedErrors> {
/// return response.forward2(
/// success: (r) => AuthToken.parse(r.data),
/// failure: (e) => switch (e) {
/// (ValidationError e) when e.code == 'email-not-confirmed' => EmailNotConfirmed(),
/// (Unauthorized) => InvalidCredentials(),
/// ValidationError e when e.code == 'email-not-confirmed' => EmailNotConfirmed(),
/// Unauthorized => InvalidCredentials(),
/// _ => e
/// });
/// }
Expand Down Expand Up @@ -147,8 +147,8 @@ class Result<T, Errors extends IExpectedErrors> {
/// return response.forward2(
/// success: (r) => AuthToken.parse(r.data),
/// failure: (e) => switch (e) {
/// (ValidationError e) when e.code == 'email-not-confirmed' => EmailNotConfirmed(),
/// (Unauthorized) => InvalidCredentials(),
/// ValidationError e when e.code == 'email-not-confirmed' => EmailNotConfirmed(),
/// Unauthorized => InvalidCredentials(),
/// _ => e
/// });
/// }
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: operation_result
description: The Result that allows to specify a list of expected errors.
version: 1.0.0
version: 1.0.1

homepage: https://github.com/vkubiv/operation_result
repository: https://github.com/vkubiv/operation_result
Expand Down

0 comments on commit beb2c9a

Please sign in to comment.