mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
add Responder impl for InternalError
This commit is contained in:
parent
0de47211b2
commit
1a80b70868
@ -1,3 +1,4 @@
|
||||
use actix_http::error::InternalError;
|
||||
use actix_http::{dev::ResponseBuilder, http::StatusCode, Error, Response};
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use futures::future::{err, ok, Either as EitherFuture, FutureResult};
|
||||
@ -252,6 +253,18 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Responder for InternalError<T>
|
||||
where
|
||||
T: std::fmt::Debug + std::fmt::Display + 'static,
|
||||
{
|
||||
type Error = Error;
|
||||
type Future = Result<Response, Error>;
|
||||
|
||||
fn respond_to(self, _: &HttpRequest) -> Self::Future {
|
||||
Err(self.into())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ResponseFuture<T>(T);
|
||||
|
||||
impl<T> ResponseFuture<T> {
|
||||
|
Loading…
Reference in New Issue
Block a user