1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-27 17:52:56 +01:00

remove FormPayloadError

This commit is contained in:
Dursun Akkurt 2018-06-12 20:26:09 +03:00
parent d4d3add17d
commit 8af082d873

View File

@ -590,47 +590,6 @@ impl From<JsonError> for JsonPayloadError {
}
}
/// A set of errors that can occur during parsing json payloads
#[derive(Fail, Debug)]
pub enum FormPayloadError {
/// Payload size is bigger than allowed. (default: 256kB)
#[fail(display = "Form payload size is bigger than allowed. (default: 256kB)")]
Overflow,
/// Content type error
#[fail(display = "Content type error")]
ContentType,
/// Deserialize error
#[fail(display = "Form deserialize error: {}", _0)]
Deserialize(#[cause] FormError),
/// Payload error
#[fail(display = "Error that occur during reading payload: {}", _0)]
Payload(#[cause] PayloadError),
}
/// Return `BadRequest` for `UrlencodedError`
impl ResponseError for FormPayloadError {
fn error_response(&self) -> HttpResponse {
match *self {
FormPayloadError::Overflow => {
HttpResponse::new(StatusCode::PAYLOAD_TOO_LARGE)
}
_ => HttpResponse::new(StatusCode::BAD_REQUEST),
}
}
}
impl From<PayloadError> for FormPayloadError {
fn from(err: PayloadError) -> FormPayloadError {
FormPayloadError::Payload(err)
}
}
impl From<FormError> for FormPayloadError {
fn from(err: FormError) -> FormPayloadError {
FormPayloadError::Deserialize(err)
}
}
/// Errors which can occur when attempting to interpret a segment string as a
/// valid path segment.
#[derive(Fail, Debug, PartialEq)]