1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 08:57:00 +02:00

added helper Task::error method

This commit is contained in:
Nikolay Kim
2017-11-25 10:52:43 -08:00
parent 45ecb87eab
commit 37c1e78c7a
4 changed files with 32 additions and 28 deletions

View File

@@ -86,6 +86,16 @@ default impl<T: StdError + Sync + Send + 'static> ErrorResponse for T {
/// `InternalServerError` for `JsonError`
impl ErrorResponse for JsonError {}
/// Return `InternalServerError` for `HttpError`,
/// Response generation can return `HttpError`, so it is internal error
impl ErrorResponse for HttpError {}
/// Return `InternalServerError` for `io::Error`
impl ErrorResponse for IoError {}
/// `InternalServerError` for `InvalidHeaderValue`
impl ErrorResponse for header::InvalidHeaderValue {}
/// Internal error
#[derive(Fail, Debug)]
#[fail(display="Unexpected task frame")]
@@ -191,13 +201,6 @@ impl From<IoError> for PayloadError {
}
}
/// Return `InternalServerError` for `HttpError`,
/// Response generation can return `HttpError`, so it is internal error
impl ErrorResponse for HttpError {}
/// Return `InternalServerError` for `io::Error`
impl ErrorResponse for IoError {}
/// Return `BadRequest` for `cookie::ParseError`
impl ErrorResponse for cookie::ParseError {
fn error_response(&self) -> HttpResponse {