From 0e7380659f844d216b206faaae6abd51f9d1aeea Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Mon, 13 Mar 2023 13:40:09 +0000 Subject: [PATCH] implement Error for BodyLimitExceeded --- actix-http/src/body/utils.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/actix-http/src/body/utils.rs b/actix-http/src/body/utils.rs index 7af5a50ad..d1449179f 100644 --- a/actix-http/src/body/utils.rs +++ b/actix-http/src/body/utils.rs @@ -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(body: B) -> Result { } /// 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;