diff --git a/src/controllers/users_controller.rs b/src/controllers/users_controller.rs index 80cdcce..56b4026 100644 --- a/src/controllers/users_controller.rs +++ b/src/controllers/users_controller.rs @@ -63,8 +63,8 @@ pub async fn show_user<'r>( pub async fn show_ssh_key<'r>( db: DbConn, username: String, -) -> Json> { - let user = User::find_by_username(username, &db).await.unwrap(); +) -> Result>> { + let user = User::find_by_username(username, &db).await?; let mut keys = vec![]; if let Some(ssh_keys) = user.ssh_key { for line in ssh_keys.lines() { @@ -74,7 +74,7 @@ pub async fn show_ssh_key<'r>( } } } - Json(keys) + Ok(Json(keys)) } #[get("/users")]