1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-24 07:53:00 +01:00

better error messages for overflow errors

This commit is contained in:
Nikolay Kim 2018-06-02 15:10:48 -07:00
parent 8c7182f6e6
commit b799677532

View File

@ -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<PayloadError> 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")]