mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 16:02: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 {
|
||||
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")]
|
||||
|
Loading…
Reference in New Issue
Block a user