1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-30 12:00:38 +00:00

add Responder impl for InternalError

This commit is contained in:
Nikolay Kim 2019-03-05 19:41:50 -08:00
parent 0de47211b2
commit 1a80b70868

View file

@ -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> {