mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 16:02:59 +01:00
relax InternalError constraints
This commit is contained in:
parent
f55ff24925
commit
7bb7adf89c
@ -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
|
||||||
}
|
}
|
||||||
|
12
src/error.rs
12
src/error.rs
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user