From 93aa220e8d0b07d1dfe2d4952f4ad02531eb67e2 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Wed, 7 Feb 2018 13:57:58 -0800 Subject: [PATCH] remove default impl for std error, it prevents use of Fail --- src/error.rs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/error.rs b/src/error.rs index 3218f410e..d166636a7 100644 --- a/src/error.rs +++ b/src/error.rs @@ -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 From for Error { } } +/// Compatibility for `failure::Error` impl ResponseError for failure::Compat where T: fmt::Display + fmt::Debug + Sync + Send + 'static { } @@ -106,14 +105,6 @@ impl From for Error { } } -/// Default error is `InternalServerError` -#[cfg(actix_nightly)] -default impl 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 {