From 8b1338ef2fcd36214c3ad90f5d3585377f28ec86 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 17 May 2022 16:48:23 +0200 Subject: [PATCH] Fix error code --- src/api/admin/bucket.rs | 2 +- src/api/admin/error.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/admin/bucket.rs b/src/api/admin/bucket.rs index dacbd427..2c21edee 100644 --- a/src/api/admin/bucket.rs +++ b/src/api/admin/bucket.rs @@ -95,7 +95,7 @@ pub async fn handle_get_bucket_info( .bucket_helper() .resolve_global_bucket_name(&ga) .await? - .ok_or_bad_request("Bucket not found")?, + .ok_or_else(|| HelperError::NoSuchBucket(ga.to_string()))?, _ => { return Err(Error::bad_request( "Either id or globalAlias must be provided (but not both)", diff --git a/src/api/admin/error.rs b/src/api/admin/error.rs index cd7e6af7..592440a5 100644 --- a/src/api/admin/error.rs +++ b/src/api/admin/error.rs @@ -2,7 +2,7 @@ use err_derive::Error; use hyper::header::HeaderValue; use hyper::{Body, HeaderMap, StatusCode}; -use garage_model::helper::error::Error as HelperError; +pub use garage_model::helper::error::Error as HelperError; use crate::common_error::CommonError; pub use crate::common_error::{CommonErrorDerivative, OkOrBadRequest, OkOrInternalError};