diff options
author | Alex <lx@deuxfleurs.fr> | 2025-02-01 17:48:25 +0000 |
---|---|---|
committer | Alex <lx@deuxfleurs.fr> | 2025-02-01 17:48:25 +0000 |
commit | d601f311865b8159a7bf1801dd8f43021d0b443b (patch) | |
tree | 07e4268d09a6bead4c4e5a2a4f122471a7a5d23b /src/api/s3/error.rs | |
parent | 9330fd79d3466051394f6d419a247d46da8f5151 (diff) | |
parent | e4de7bdfd5e6acc05309f59d7f77755f0807e8e4 (diff) | |
download | garage-d601f311865b8159a7bf1801dd8f43021d0b443b.tar.gz garage-d601f311865b8159a7bf1801dd8f43021d0b443b.zip |
Merge pull request 'split garage_api in garage_api_{common,s3,k2v,admin}' (#947) from split-garage-api into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/947
Diffstat (limited to 'src/api/s3/error.rs')
-rw-r--r-- | src/api/s3/error.rs | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/api/s3/error.rs b/src/api/s3/error.rs index 22d2fe14..1bb8909c 100644 --- a/src/api/s3/error.rs +++ b/src/api/s3/error.rs @@ -6,20 +6,28 @@ use hyper::{HeaderMap, StatusCode}; use garage_model::helper::error::Error as HelperError; -pub(crate) use crate::common_error::pass_helper_error; -use crate::common_error::{helper_error_as_internal, CommonError}; -pub use crate::common_error::{CommonErrorDerivative, OkOrBadRequest, OkOrInternalError}; -use crate::generic_server::ApiError; -use crate::helpers::*; -use crate::s3::xml as s3_xml; -use crate::signature::error::Error as SignatureError; +pub(crate) use garage_api_common::common_error::pass_helper_error; + +use garage_api_common::common_error::{ + commonErrorDerivative, helper_error_as_internal, CommonError, +}; + +pub use garage_api_common::common_error::{ + CommonErrorDerivative, OkOrBadRequest, OkOrInternalError, +}; + +use garage_api_common::generic_server::ApiError; +use garage_api_common::helpers::*; +use garage_api_common::signature::error::Error as SignatureError; + +use crate::xml as s3_xml; /// Errors of this crate #[derive(Debug, Error)] pub enum Error { #[error(display = "{}", _0)] /// Error from common error - Common(CommonError), + Common(#[error(source)] CommonError), // Category: cannot process /// Authorization Header Malformed @@ -81,14 +89,7 @@ pub enum Error { NotImplemented(String), } -impl<T> From<T> for Error -where - CommonError: From<T>, -{ - fn from(err: T) -> Self { - Error::Common(CommonError::from(err)) - } -} +commonErrorDerivative!(Error); // Helper errors are always passed as internal errors by default. // To pass the specific error code back to the client, use `pass_helper_error`. @@ -98,8 +99,6 @@ impl From<HelperError> for Error { } } -impl CommonErrorDerivative for Error {} - impl From<roxmltree::Error> for Error { fn from(err: roxmltree::Error) -> Self { Self::InvalidXml(format!("{}", err)) |