Return 404 from API if no user is found

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
Nathan Sobo 2022-05-18 10:32:58 -06:00
parent 7e2d1fefc4
commit b3038c2de9

View file

@ -135,7 +135,7 @@ async fn get_user(
.db
.get_user_by_github_login(&login)
.await?
.ok_or_else(|| anyhow!("user not found"))?;
.ok_or_else(|| Error::Http(StatusCode::NOT_FOUND, "User not found".to_string()))?;
Ok(Json(user))
}