1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-30 18:44:35 +01:00

implement Error for BodyLimitExceeded

This commit is contained in:
Rob Ede 2023-03-13 13:40:09 +00:00
parent 44c5cdaa10
commit 0e7380659f
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933

View File

@ -3,6 +3,7 @@ use std::task::Poll;
use actix_rt::pin; use actix_rt::pin;
use actix_utils::future::poll_fn; use actix_utils::future::poll_fn;
use bytes::{Bytes, BytesMut}; use bytes::{Bytes, BytesMut};
use derive_more::{Display, Error};
use futures_core::ready; use futures_core::ready;
use super::{BodySize, MessageBody}; use super::{BodySize, MessageBody};
@ -36,7 +37,8 @@ pub async fn to_bytes<B: MessageBody>(body: B) -> Result<Bytes, B::Error> {
} }
/// Error type returned from [`to_bytes_limited`] when body produced exceeds limit. /// Error type returned from [`to_bytes_limited`] when body produced exceeds limit.
#[derive(Debug)] #[derive(Debug, Display, Error)]
#[display(fmt = "limit exceeded while collecting body bytes")]
#[non_exhaustive] #[non_exhaustive]
pub struct BodyLimitExceeded; pub struct BodyLimitExceeded;