diff --git a/Cargo.toml b/Cargo.toml index f940ae86c..5bcaea7c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/error.rs b/src/error.rs index f71b429fd..cd5cabaa6 100644 --- a/src/error.rs +++ b/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 From for Error { // } // } +/// Return `GATEWAY_TIMEOUT` for `TimeoutError` +impl ResponseError for TimeoutError { + 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 {}