(self)
| 36 | |
| 37 | impl IntoResponse for ServerError { |
| 38 | fn into_response(self) -> Response { |
| 39 | // Convert the error to a JSON object with an "error" field |
| 40 | let error_json = serde_json::json!({ |
| 41 | "error": self.to_string() |
| 42 | }); |
| 43 | |
| 44 | // Return as a JSON response with BAD_REQUEST status |
| 45 | (axum::http::StatusCode::BAD_REQUEST, Json(error_json)).into_response() |
| 46 | } |
| 47 | } |