aboutsummaryrefslogtreecommitdiff
path: root/src/api/admin/error.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-05-13 15:04:53 +0200
committerAlex Auvolat <alex@adnab.me>2022-05-13 15:04:53 +0200
commit96b11524d53b3616a28f33e2b057655be1639f6f (patch)
tree324a8a9624c5b861fb5a09b0ae0e0c07f6b9614c /src/api/admin/error.rs
parentc0fb9fd0fe553e5eda39dcb1a09f059bcd631b6c (diff)
downloadgarage-96b11524d53b3616a28f33e2b057655be1639f6f.tar.gz
garage-96b11524d53b3616a28f33e2b057655be1639f6f.zip
Error refactoring
Diffstat (limited to 'src/api/admin/error.rs')
-rw-r--r--src/api/admin/error.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/api/admin/error.rs b/src/api/admin/error.rs
index 3e488d8d..1f49fed5 100644
--- a/src/api/admin/error.rs
+++ b/src/api/admin/error.rs
@@ -3,10 +3,10 @@ use hyper::header::HeaderValue;
use hyper::{Body, HeaderMap, StatusCode};
use garage_model::helper::error::Error as HelperError;
-use garage_util::error::Error as GarageError;
use crate::generic_server::ApiError;
-pub use crate::common_error::*;
+use crate::common_error::CommonError;
+pub use crate::common_error::{OkOrBadRequest, OkOrInternalError};
/// Errors of this crate
#[derive(Debug, Error)]
@@ -47,7 +47,9 @@ pub enum Error {
}
impl<T> From<T> for Error
-where CommonError: From<T> {
+where
+ CommonError: From<T>,
+{
fn from(err: T) -> Self {
Error::CommonError(CommonError::from(err))
}
@@ -83,7 +85,10 @@ impl ApiError for Error {
}
fn http_body(&self, garage_region: &str, path: &str) -> Body {
- Body::from(format!("ERROR: {}\n\ngarage region: {}\npath: {}", self, garage_region, path))
+ Body::from(format!(
+ "ERROR: {}\n\ngarage region: {}\npath: {}",
+ self, garage_region, path
+ ))
}
}