this repo has no description
at main 520 B view raw
1use axum::{ 2 http::StatusCode, 3 response::{IntoResponse, Response}, 4}; 5 6#[derive(Debug)] 7pub struct SupercellError(pub anyhow::Error); 8 9impl<E> From<E> for SupercellError 10where 11 E: Into<anyhow::Error>, 12{ 13 fn from(err: E) -> Self { 14 Self(err.into()) 15 } 16} 17 18impl IntoResponse for SupercellError { 19 fn into_response(self) -> Response { 20 { 21 tracing::error!(error = ?self.0, "internal server error"); 22 (StatusCode::INTERNAL_SERVER_ERROR).into_response() 23 } 24 } 25}