aboutsummaryrefslogtreecommitdiff
path: root/src/api/admin/api_server.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-05-13 19:18:51 +0200
committerAlex Auvolat <alex@adnab.me>2022-05-13 19:18:51 +0200
commitea325d78d36d19f59a0849ace1f4567e2b095bd7 (patch)
treebfc05dd1f8df3d1fae84a1af433f4ae56dbc2c31 /src/api/admin/api_server.rs
parentec16d166f940f59098ae5cc0c0b3d8298f1bcc78 (diff)
downloadgarage-ea325d78d36d19f59a0849ace1f4567e2b095bd7.tar.gz
garage-ea325d78d36d19f59a0849ace1f4567e2b095bd7.zip
More error refactoring
Diffstat (limited to 'src/api/admin/api_server.rs')
-rw-r--r--src/api/admin/api_server.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/api/admin/api_server.rs b/src/api/admin/api_server.rs
index b2effa62..098a54aa 100644
--- a/src/api/admin/api_server.rs
+++ b/src/api/admin/api_server.rs
@@ -114,13 +114,9 @@ impl ApiHandler for AdminApiServer {
if let Some(h) = expected_auth_header {
match req.headers().get("Authorization") {
- None => Err(Error::Forbidden(
- "Authorization token must be provided".into(),
- )),
+ None => Err(Error::forbidden("Authorization token must be provided")),
Some(v) if v.to_str().map(|hv| hv == h).unwrap_or(false) => Ok(()),
- _ => Err(Error::Forbidden(
- "Invalid authorization token provided".into(),
- )),
+ _ => Err(Error::forbidden("Invalid authorization token provided")),
}?;
}