use axum::{ http::StatusCode, response::{IntoResponse, Response}, Json, }; pub type Result = std::result::Result; #[derive(thiserror::Error, Debug)] pub enum Error { #[error("IO error: {0}")] IO(#[from] std::io::Error), #[error("Axum Error: {0:?}")] Axum(#[from] axum::Error), } impl IntoResponse for Error { fn into_response(self) -> Response { let body = Json(serde_json::json!({ "error": self.to_string(), })); (StatusCode::INTERNAL_SERVER_ERROR, body).into_response() } }