diff options
author | FxQnLr <[email protected]> | 2024-02-25 15:15:19 +0100 |
---|---|---|
committer | FxQnLr <[email protected]> | 2024-02-25 15:15:19 +0100 |
commit | 9058f191b69ecafc8fdeace227ac113412d03888 (patch) | |
tree | 88ae071fa31c9a5831722ec82878ccf8fd2b224a /src/error.rs | |
parent | 2f9f18b80a9e2134f674f345e48a5f21de5efadd (diff) | |
download | webol-9058f191b69ecafc8fdeace227ac113412d03888.tar webol-9058f191b69ecafc8fdeace227ac113412d03888.tar.gz webol-9058f191b69ecafc8fdeace227ac113412d03888.zip |
Closes #16. Impl auth as extractor
Diffstat (limited to 'src/error.rs')
-rw-r--r-- | src/error.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/error.rs b/src/error.rs index 66a61f4..513b51b 100644 --- a/src/error.rs +++ b/src/error.rs | |||
@@ -1,8 +1,8 @@ | |||
1 | use ::ipnetwork::IpNetworkError; | ||
1 | use axum::http::header::ToStrError; | 2 | use axum::http::header::ToStrError; |
2 | use axum::http::StatusCode; | 3 | use axum::http::StatusCode; |
3 | use axum::response::{IntoResponse, Response}; | 4 | use axum::response::{IntoResponse, Response}; |
4 | use axum::Json; | 5 | use axum::Json; |
5 | use ::ipnetwork::IpNetworkError; | ||
6 | use mac_address::MacParseError; | 6 | use mac_address::MacParseError; |
7 | use serde_json::json; | 7 | use serde_json::json; |
8 | use std::io; | 8 | use std::io; |
@@ -10,9 +10,6 @@ use tracing::error; | |||
10 | 10 | ||
11 | #[derive(Debug, thiserror::Error)] | 11 | #[derive(Debug, thiserror::Error)] |
12 | pub enum Error { | 12 | pub enum Error { |
13 | #[error("generic error")] | ||
14 | Generic, | ||
15 | |||
16 | #[error("db: {source}")] | 13 | #[error("db: {source}")] |
17 | Db { | 14 | Db { |
18 | #[from] | 15 | #[from] |
@@ -54,7 +51,6 @@ impl IntoResponse for Error { | |||
54 | fn into_response(self) -> Response { | 51 | fn into_response(self) -> Response { |
55 | error!("{}", self.to_string()); | 52 | error!("{}", self.to_string()); |
56 | let (status, error_message) = match self { | 53 | let (status, error_message) = match self { |
57 | Self::Generic => (StatusCode::INTERNAL_SERVER_ERROR, ""), | ||
58 | Self::Db { source } => { | 54 | Self::Db { source } => { |
59 | error!("{source}"); | 55 | error!("{source}"); |
60 | (StatusCode::INTERNAL_SERVER_ERROR, "Server Error") | 56 | (StatusCode::INTERNAL_SERVER_ERROR, "Server Error") |