Files
nym/nyx-chain-watcher/pgsql/src/http/error.rs
T
Mark Sinclair e8f76aa7ee wip
2025-07-06 13:10:58 +01:00

22 lines
513 B
Rust

pub(crate) type HttpResult<T> = Result<T, Error>;
pub(crate) struct Error {
message: String,
status: axum::http::StatusCode,
}
impl Error {
pub(crate) fn internal() -> Self {
Self {
message: String::from("Internal server error"),
status: axum::http::StatusCode::INTERNAL_SERVER_ERROR,
}
}
}
impl axum::response::IntoResponse for Error {
fn into_response(self) -> axum::response::Response {
(self.status, self.message).into_response()
}
}