1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-24 07:53:00 +01:00

relax InternalError constraints

This commit is contained in:
Nikolay Kim 2018-01-20 22:02:42 -08:00
parent f55ff24925
commit 7bb7adf89c
2 changed files with 7 additions and 8 deletions

View File

@ -116,8 +116,7 @@ specific error response. We can use helper types for first example with custom e
#[macro_use] extern crate failure; #[macro_use] extern crate failure;
use actix_web::*; use actix_web::*;
#[derive(Fail, Debug)] #[derive(Debug)]
#[fail(display="Error {}", name)]
struct MyError { struct MyError {
name: &'static str name: &'static str
} }

View File

@ -531,7 +531,7 @@ impl<T> InternalError<T> {
} }
impl<T> Fail for InternalError<T> impl<T> Fail for InternalError<T>
where T: Send + Sync + fmt::Display + fmt::Debug + 'static where T: Send + Sync + fmt::Debug + 'static
{ {
fn backtrace(&self) -> Option<&Backtrace> { fn backtrace(&self) -> Option<&Backtrace> {
Some(&self.backtrace) Some(&self.backtrace)
@ -539,7 +539,7 @@ impl<T> Fail for InternalError<T>
} }
impl<T> fmt::Debug for InternalError<T> impl<T> fmt::Debug for InternalError<T>
where T: Send + Sync + fmt::Display + fmt::Debug + 'static where T: Send + Sync + fmt::Debug + 'static
{ {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(&self.cause, f) fmt::Debug::fmt(&self.cause, f)
@ -547,15 +547,15 @@ impl<T> fmt::Debug for InternalError<T>
} }
impl<T> fmt::Display for InternalError<T> impl<T> fmt::Display for InternalError<T>
where T: Send + Sync + fmt::Display + fmt::Debug + 'static where T: Send + Sync + fmt::Debug + 'static
{ {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Display::fmt(&self.cause, f) fmt::Debug::fmt(&self.cause, f)
} }
} }
impl<T> ResponseError for InternalError<T> impl<T> ResponseError for InternalError<T>
where T: Send + Sync + fmt::Display + fmt::Debug + 'static where T: Send + Sync + fmt::Debug + 'static
{ {
fn error_response(&self) -> HttpResponse { fn error_response(&self) -> HttpResponse {
HttpResponse::new(self.status, Body::Empty) HttpResponse::new(self.status, Body::Empty)
@ -563,7 +563,7 @@ impl<T> ResponseError for InternalError<T>
} }
impl<T> Responder for InternalError<T> impl<T> Responder for InternalError<T>
where T: Send + Sync + fmt::Display + fmt::Debug + 'static where T: Send + Sync + fmt::Debug + 'static
{ {
type Item = HttpResponse; type Item = HttpResponse;
type Error = Error; type Error = Error;