From b799677532e46618704caa47aebd948ae26618ef Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sat, 2 Jun 2018 15:10:48 -0700 Subject: [PATCH] better error messages for overflow errors --- src/error.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/error.rs b/src/error.rs index 6bb94af5..cfb6a028 100644 --- a/src/error.rs +++ b/src/error.rs @@ -301,7 +301,7 @@ impl ResponseError for PayloadError { fn error_response(&self) -> HttpResponse { match *self { PayloadError::Overflow => HttpResponse::new(StatusCode::PAYLOAD_TOO_LARGE), - _ => HttpResponse::new(StatusCode::BAD_REQUEST) + _ => HttpResponse::new(StatusCode::BAD_REQUEST), } } } @@ -427,8 +427,10 @@ pub enum UrlencodedError { /// Can not decode chunked transfer encoding #[fail(display = "Can not decode chunked transfer encoding")] Chunked, - /// Payload size is bigger than 256k - #[fail(display = "Payload size is bigger than 256k")] + /// Payload size is bigger than allowed. (default: 256kB) + #[fail( + display = "Urlencoded payload size is bigger than allowed. (default: 256kB)" + )] Overflow, /// Payload size is now known #[fail(display = "Payload size is now known")] @@ -468,8 +470,8 @@ impl From for UrlencodedError { /// A set of errors that can occur during parsing json payloads #[derive(Fail, Debug)] pub enum JsonPayloadError { - /// Payload size is bigger than 256k - #[fail(display = "Payload size is bigger than 256k")] + /// Payload size is bigger than allowed. (default: 256kB) + #[fail(display = "Json payload size is bigger than allowed. (default: 256kB)")] Overflow, /// Content type error #[fail(display = "Content type error")]