1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-09-09 05:08:32 +00:00

remove default impl for std error, it prevents use of Fail

This commit is contained in:
Nikolay Kim 2018-02-07 13:57:58 -08:00
parent 81e4fb9353
commit 93aa220e8d

View file

@ -4,11 +4,9 @@ use std::str::Utf8Error;
use std::string::FromUtf8Error;
use std::io::Error as IoError;
#[cfg(actix_nightly)]
use std::error::Error as StdError;
use cookie;
use httparse;
use actix::MailboxError;
use futures::Canceled;
use failure;
use failure::{Fail, Backtrace};
@ -96,6 +94,7 @@ impl<T: ResponseError> From<T> for Error {
}
}
/// Compatibility for `failure::Error`
impl<T> ResponseError for failure::Compat<T>
where T: fmt::Display + fmt::Debug + Sync + Send + 'static
{ }
@ -106,14 +105,6 @@ impl From<failure::Error> for Error {
}
}
/// Default error is `InternalServerError`
#[cfg(actix_nightly)]
default impl<T: StdError + Sync + Send + 'static> ResponseError for T {
fn error_response(&self) -> HttpResponse {
HttpResponse::new(StatusCode::INTERNAL_SERVER_ERROR, Body::Empty)
}
}
/// `InternalServerError` for `JsonError`
impl ResponseError for JsonError {}
@ -145,6 +136,9 @@ impl ResponseError for header::InvalidHeaderValue {}
/// `InternalServerError` for `futures::Canceled`
impl ResponseError for Canceled {}
/// `InternalServerError` for `actix::MailboxError`
impl ResponseError for MailboxError {}
/// A set of errors that can occur during parsing HTTP streams
#[derive(Fail, Debug)]
pub enum ParseError {