mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-28 01:32:57 +01:00
add ErrorResponse impl for TimeoutError
This commit is contained in:
parent
e178db7f74
commit
f9724fa0ec
@ -40,7 +40,7 @@ ssl = ["openssl"]
|
||||
actix-service = "0.2.1"
|
||||
actix-codec = "0.1.0"
|
||||
actix-connector = "0.2.0"
|
||||
actix-utils = "0.2.1"
|
||||
actix-utils = "0.2.2"
|
||||
|
||||
base64 = "0.10"
|
||||
backtrace = "0.3"
|
||||
@ -80,7 +80,6 @@ openssl = { version="0.10", optional = true }
|
||||
actix-rt = "0.1.0"
|
||||
actix-server = { version="0.2", features=["ssl"] }
|
||||
actix-connector = { version="0.2.0", features=["ssl"] }
|
||||
actix-utils = "0.2.1"
|
||||
actix-http-test = { path="test-server", features=["ssl"] }
|
||||
env_logger = "0.6"
|
||||
serde_derive = "1.0"
|
||||
|
11
src/error.rs
11
src/error.rs
@ -6,6 +6,7 @@ use std::string::FromUtf8Error;
|
||||
use std::{fmt, io, result};
|
||||
|
||||
// use actix::MailboxError;
|
||||
use actix_utils::timeout::TimeoutError;
|
||||
use backtrace::Backtrace;
|
||||
use cookie;
|
||||
use derive_more::{Display, From};
|
||||
@ -187,6 +188,16 @@ impl<T: ResponseError + 'static> From<T> for Error {
|
||||
// }
|
||||
// }
|
||||
|
||||
/// Return `GATEWAY_TIMEOUT` for `TimeoutError`
|
||||
impl<E: ResponseError> ResponseError for TimeoutError<E> {
|
||||
fn error_response(&self) -> Response {
|
||||
match self {
|
||||
TimeoutError::Service(e) => e.error_response(),
|
||||
TimeoutError::Timeout => Response::new(StatusCode::GATEWAY_TIMEOUT),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// `InternalServerError` for `JsonError`
|
||||
impl ResponseError for JsonError {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user