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/k2v/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/k2v/error.rs')
-rw-r--r-- | src/api/k2v/error.rs | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/api/k2v/error.rs b/src/api/k2v/error.rs index dbe4be2c..3cd0e6f7 100644 --- a/src/api/k2v/error.rs +++ b/src/api/k2v/error.rs @@ -2,19 +2,21 @@ use err_derive::Error; use hyper::header::HeaderValue; use hyper::{HeaderMap, StatusCode}; -use crate::common_error::CommonError; -pub(crate) use crate::common_error::{helper_error_as_internal, pass_helper_error}; -pub use crate::common_error::{CommonErrorDerivative, OkOrBadRequest, OkOrInternalError}; -use crate::generic_server::ApiError; -use crate::helpers::*; -use crate::signature::error::Error as SignatureError; +use garage_api_common::common_error::{commonErrorDerivative, CommonError}; +pub(crate) use garage_api_common::common_error::{helper_error_as_internal, pass_helper_error}; +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; /// 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 @@ -42,16 +44,7 @@ pub enum Error { InvalidUtf8Str(#[error(source)] std::str::Utf8Error), } -impl<T> From<T> for Error -where - CommonError: From<T>, -{ - fn from(err: T) -> Self { - Error::Common(CommonError::from(err)) - } -} - -impl CommonErrorDerivative for Error {} +commonErrorDerivative!(Error); impl From<SignatureError> for Error { fn from(err: SignatureError) -> Self { |