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