aboutsummaryrefslogtreecommitdiff
path: root/src/api/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/error.rs')
-rw-r--r--src/api/error.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/api/error.rs b/src/api/error.rs
index 828a2342..d6d4a1d7 100644
--- a/src/api/error.rs
+++ b/src/api/error.rs
@@ -4,6 +4,7 @@ use err_derive::Error;
use hyper::header::HeaderValue;
use hyper::{HeaderMap, StatusCode};
+use garage_model::helper::error::Error as HelperError;
use garage_util::error::Error as GarageError;
use crate::s3_xml;
@@ -83,6 +84,15 @@ impl From<quick_xml::de::DeError> for Error {
}
}
+impl From<HelperError> for Error {
+ fn from(err: HelperError) -> Self {
+ match err {
+ HelperError::Internal(i) => Self::InternalError(i),
+ HelperError::BadRequest(b) => Self::BadRequest(b),
+ }
+ }
+}
+
impl Error {
/// Get the HTTP status code that best represents the meaning of the error for the client
pub fn http_status_code(&self) -> StatusCode {