use axum::{ http::StatusCode, response::{IntoResponse, Response}, Json, }; use serde_json::json; pub enum Error { Generic, } impl IntoResponse for Error { fn into_response(self) -> Response { let (status, error_message) = match self { Error::Generic => ( StatusCode::INTERNAL_SERVER_ERROR, "Generic error, can't find why", ), }; let body = Json(json!({ "error": error_message, })); (status, body).into_response() } }