Skip to content

Commit

Permalink
implement Error for BodyLimitExceeded
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede committed Mar 13, 2023
1 parent 44c5cda commit 0e73806
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion actix-http/src/body/utils.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 0e73806

Please sign in to comment.