1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-28 01:32:57 +01:00

Specialize ResponseError for PayloadError

Closes #257
This commit is contained in:
Douman 2018-06-02 22:20:22 +03:00
parent 593a66324f
commit fce8dd275a

View File

@ -294,7 +294,14 @@ impl From<IoError> for PayloadError {
} }
/// `InternalServerError` for `PayloadError` /// `InternalServerError` for `PayloadError`
impl ResponseError for PayloadError {} impl ResponseError for PayloadError {
fn error_response(&self) -> HttpResponse {
match *self {
PayloadError::Overflow => HttpResponse::new(StatusCode::PAYLOAD_TOO_LARGE),
_ => HttpResponse::new(StatusCode::BAD_REQUEST)
}
}
}
/// Return `BadRequest` for `cookie::ParseError` /// Return `BadRequest` for `cookie::ParseError`
impl ResponseError for cookie::ParseError { impl ResponseError for cookie::ParseError {