mirror of
https://github.com/actix/actix-extras.git
synced 2025-08-30 19:10:20 +02:00
add ErrorResponse impl for TimeoutError
This commit is contained in:
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 {}
|
||||
|
||||
|
Reference in New Issue
Block a user