aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin <quentin@deuxfleurs.fr>2021-01-15 16:24:27 +0100
committerQuentin <quentin@deuxfleurs.fr>2021-01-15 16:25:44 +0100
commit11a79a95dd9b2f2e0dd2d9dc999abd24f4ee232b (patch)
tree586974246b66dd56ae389eda910952ecd0587560
parentc441a358cdc8447d7ff7c6ff8b066ae2d0d99409 (diff)
downloadgarage-11a79a95dd9b2f2e0dd2d9dc999abd24f4ee232b.tar.gz
garage-11a79a95dd9b2f2e0dd2d9dc999abd24f4ee232b.zip
Simplify Error file
-rw-r--r--src/web/error.rs18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/web/error.rs b/src/web/error.rs
index 220bacfe..14bc3b75 100644
--- a/src/web/error.rs
+++ b/src/web/error.rs
@@ -12,16 +12,6 @@ pub enum Error {
#[error(display = "Internal error: {}", _0)]
InternalError(#[error(source)] GarageError),
- #[error(display = "Internal error (Hyper error): {}", _0)]
- Hyper(#[error(source)] hyper::Error),
-
- #[error(display = "Internal error (HTTP error): {}", _0)]
- HTTP(#[error(source)] http::Error),
-
- // Category: cannot process
- #[error(display = "Forbidden: {}", _0)]
- Forbidden(String),
-
#[error(display = "Not found")]
NotFound,
@@ -29,9 +19,6 @@ pub enum Error {
#[error(display = "Invalid UTF-8: {}", _0)]
InvalidUTF8(#[error(source)] std::str::Utf8Error),
- #[error(display = "Invalid XML: {}", _0)]
- InvalidXML(#[error(source)] roxmltree::Error),
-
#[error(display = "Invalid header value: {}", _0)]
InvalidHeader(#[error(source)] hyper::header::ToStrError),
@@ -44,11 +31,8 @@ impl Error {
match self {
Error::NotFound => StatusCode::NOT_FOUND,
Error::ApiError(e) => e.http_status_code(),
- Error::Forbidden(_) => StatusCode::FORBIDDEN,
Error::InternalError(GarageError::RPC(_)) => StatusCode::SERVICE_UNAVAILABLE,
- Error::InternalError(_) | Error::Hyper(_) | Error::HTTP(_) => {
- StatusCode::INTERNAL_SERVER_ERROR
- }
+ Error::InternalError(_) => StatusCode::INTERNAL_SERVER_ERROR,
_ => StatusCode::BAD_REQUEST,
}
}