Updated to new error types from redox_users and simplefied the inspection and downcasting of the error on login.

This commit is contained in:
Jose Narvaez
2017-12-01 23:16:14 +00:00
parent 13681c3442
commit fd81487760
3 changed files with 24 additions and 34 deletions
+6 -16
View File
@@ -73,22 +73,12 @@ pub fn main() {
let user_option = match get_user_by_name(user) {
Ok(user) => Some(user),
Err(ref err) if err.downcast_ref::<UsersError>() == Some(&UsersError::NotFound) => {
None
},
Err(err) => {
match err.downcast::<UsersError>() {
Ok(users_error) => {
match users_error {
UsersError::UserNotFound { user: _ } => None,
err => {
println!("login: {}", err);
exit(1);
}
}
},
Err(err) => {
println!("login: {}", err);
exit(1);
}
}
println!("login: {}", err);
exit(1);
}
};
@@ -133,4 +123,4 @@ pub fn main() {
stdout.flush().try(&mut stderr);;
}
}
}
}