1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use core::fmt;

use std::error;

use super::{error_from_service, forward_blank_bad_request};

pub use xitca_http::error::BodyError;

#[derive(Debug, Clone)]
pub struct BodyOverFlow {
    pub(crate) limit: usize,
}

impl fmt::Display for BodyOverFlow {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "body size reached limit: {} bytes", self.limit)
    }
}

impl error::Error for BodyOverFlow {}

error_from_service!(BodyOverFlow);
forward_blank_bad_request!(BodyOverFlow);