From 5b7302cf9be4e0badd691203e160ca110613e34c Mon Sep 17 00:00:00 2001 From: FxQnLr Date: Thu, 2 Nov 2023 19:44:29 +0100 Subject: ping timeout and cleanup --- src/error.rs | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) (limited to 'src/error.rs') diff --git a/src/error.rs b/src/error.rs index 1592a78..5b82534 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,4 +1,3 @@ -use std::error::Error; use std::io; use axum::http::StatusCode; use axum::Json; @@ -10,9 +9,7 @@ use crate::auth::AuthError; #[derive(Debug)] pub enum WebolError { Generic, - // User(UserError), Auth(AuthError), - Ping(surge_ping::SurgeError), DB(sqlx::Error), IpParse(::Err), BufferParse(std::num::ParseIntError), @@ -22,13 +19,10 @@ pub enum WebolError { impl IntoResponse for WebolError { fn into_response(self) -> Response { let (status, error_message) = match self { - Self::Auth(err) => err.get(), - // Self::User(err) => err.get(), - Self::Generic => (StatusCode::INTERNAL_SERVER_ERROR, ""), - Self::Ping(err) => { - error!("Ping: {}", err.source().unwrap()); - (StatusCode::INTERNAL_SERVER_ERROR, "Server Error") + Self::Auth(err) => { + err.get() }, + Self::Generic => (StatusCode::INTERNAL_SERVER_ERROR, ""), Self::IpParse(err) => { error!("server error: {}", err.to_string()); (StatusCode::INTERNAL_SERVER_ERROR, "Server Error") @@ -51,17 +45,4 @@ impl IntoResponse for WebolError { })); (status, body).into_response() } -} - -// #[derive(Debug)] -// pub enum UserError { -// UnknownUUID, -// } -// -// impl UserError { -// pub fn get(self) -> (StatusCode, &'static str) { -// match self { -// Self::UnknownUUID => (StatusCode::UNPROCESSABLE_ENTITY, "Unknown UUID"), -// } -// } -// } +} \ No newline at end of file -- cgit v1.2.3