mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-24 08:22:59 +01:00
better error messages for overflow errors
This commit is contained in:
parent
8c7182f6e6
commit
b799677532
12
src/error.rs
12
src/error.rs
@ -301,7 +301,7 @@ impl ResponseError for PayloadError {
|
|||||||
fn error_response(&self) -> HttpResponse {
|
fn error_response(&self) -> HttpResponse {
|
||||||
match *self {
|
match *self {
|
||||||
PayloadError::Overflow => HttpResponse::new(StatusCode::PAYLOAD_TOO_LARGE),
|
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
|
/// Can not decode chunked transfer encoding
|
||||||
#[fail(display = "Can not decode chunked transfer encoding")]
|
#[fail(display = "Can not decode chunked transfer encoding")]
|
||||||
Chunked,
|
Chunked,
|
||||||
/// Payload size is bigger than 256k
|
/// Payload size is bigger than allowed. (default: 256kB)
|
||||||
#[fail(display = "Payload size is bigger than 256k")]
|
#[fail(
|
||||||
|
display = "Urlencoded payload size is bigger than allowed. (default: 256kB)"
|
||||||
|
)]
|
||||||
Overflow,
|
Overflow,
|
||||||
/// Payload size is now known
|
/// Payload size is now known
|
||||||
#[fail(display = "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
|
/// A set of errors that can occur during parsing json payloads
|
||||||
#[derive(Fail, Debug)]
|
#[derive(Fail, Debug)]
|
||||||
pub enum JsonPayloadError {
|
pub enum JsonPayloadError {
|
||||||
/// Payload size is bigger than 256k
|
/// Payload size is bigger than allowed. (default: 256kB)
|
||||||
#[fail(display = "Payload size is bigger than 256k")]
|
#[fail(display = "Json payload size is bigger than allowed. (default: 256kB)")]
|
||||||
Overflow,
|
Overflow,
|
||||||
/// Content type error
|
/// Content type error
|
||||||
#[fail(display = "Content type error")]
|
#[fail(display = "Content type error")]
|
||||||
|
Loading…
Reference in New Issue
Block a user