Files
nyeki-api/src/handlers/v1/schemas.rs
T
2025-07-13 18:46:34 +00:00

21 lines
481 B
Rust

use axum::{Json, response::IntoResponse};
use reqwest::StatusCode;
use serde::Serialize;
#[derive(Debug, Serialize)]
pub struct Error {
pub status: u16,
pub message: String,
}
impl IntoResponse for Error {
fn into_response(self) -> axum::response::Response {
(
StatusCode::from_u16(self.status)
.expect("The status code provided was not a valid status code"),
Json(self),
)
.into_response()
}
}