1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-05-20 09:18:26 +00: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_utils::future::poll_fn;
use bytes::{Bytes, BytesMut};
use derive_more::{Display, Error};
use futures_core::ready;
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.
#[derive(Debug)]
#[derive(Debug, Display, Error)]
#[display(fmt = "limit exceeded while collecting body bytes")]
#[non_exhaustive]
pub struct BodyLimitExceeded;