aboutsummaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs6
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 @@
1use ::ipnetwork::IpNetworkError;
1use axum::http::header::ToStrError; 2use axum::http::header::ToStrError;
2use axum::http::StatusCode; 3use axum::http::StatusCode;
3use axum::response::{IntoResponse, Response}; 4use axum::response::{IntoResponse, Response};
4use axum::Json; 5use axum::Json;
5use ::ipnetwork::IpNetworkError;
6use mac_address::MacParseError; 6use mac_address::MacParseError;
7use serde_json::json; 7use serde_json::json;
8use std::io; 8use std::io;
@@ -10,9 +10,6 @@ use tracing::error;
10 10
11#[derive(Debug, thiserror::Error)] 11#[derive(Debug, thiserror::Error)]
12pub enum Error { 12pub 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")