use http::StatusCode;
use topcoat_core::{context::Cx, error::Result};
use crate::{IntoResponse, Response};
#[must_use]
pub fn not_found() -> NotFoundError {
NotFoundError::new()
}
#[derive(Debug)]
pub struct NotFoundError {
_priv: (),
}
impl NotFoundError {
fn new() -> Self {
Self { _priv: () }
}
}
impl std::fmt::Display for NotFoundError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("not found")
}
}
impl std::error::Error for NotFoundError {}
impl IntoResponse for NotFoundError {
fn into_response(self, cx: &Cx) -> Result<Response> {
(StatusCode::NOT_FOUND, "not found").into_response(cx)
}
}