From 8af082d8732816a3b3e8711a45a65038cef0abdc Mon Sep 17 00:00:00 2001 From: Dursun Akkurt Date: Tue, 12 Jun 2018 20:26:09 +0300 Subject: [PATCH] remove FormPayloadError --- src/error.rs | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/src/error.rs b/src/error.rs index 39e66a0d..bbafb1c4 100644 --- a/src/error.rs +++ b/src/error.rs @@ -590,47 +590,6 @@ impl From 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 for FormPayloadError { - fn from(err: PayloadError) -> FormPayloadError { - FormPayloadError::Payload(err) - } -} - -impl From 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)]