コード例 #1
0
 private UserActionResult ToUserActionResult(ITry <Unit, SignInError> t) =>
 t.Match(
     s => UserActionResult.Success(),
     e => e.Match(
         SignInError.InvalidCredentials, _ => UserActionResult.Error(UserMessages.InvalidCredentials()),
         SignInError.NoConnection, _ => UserActionResult.Error(UserMessages.NoConnection())
         )
     );
コード例 #2
0
 private UserActionResult ToUserActionResult(ITry <Unit, SignUpError[]> t) =>
 t.Match(
     s => UserActionResult.Success(),
     e => e.First().Match(
         SignUpError.NoConnection, _ => UserActionResult.Error(UserMessages.NoConnection()),
         SignUpError.InvalidEmail, _ => Email.Invalidate().Pipe(u => UserActionResult.Error()),
         SignUpError.PasswordTooShort, _ => Password.Invalidate().Pipe(u => UserActionResult.Error()),
         SignUpError.AccountAlreadyExists, _ => UserActionResult.Error(UserMessages.AccountAlreadyExists())
         )
     );