diff --git a/actix-http/Cargo.toml b/actix-http/Cargo.toml index 99d80b0be..809d4d677 100644 --- a/actix-http/Cargo.toml +++ b/actix-http/Cargo.toml @@ -55,7 +55,6 @@ actix-utils = "0.3.4" actix-server-config = "0.1.0" base64 = "0.10" -backtrace = "0.3" bitflags = "1.0" bytes = "0.4" byteorder = "1.2" diff --git a/actix-http/src/error.rs b/actix-http/src/error.rs index 820071b1e..23e6728d8 100644 --- a/actix-http/src/error.rs +++ b/actix-http/src/error.rs @@ -7,7 +7,6 @@ use std::{fmt, io, result}; // use actix::MailboxError; use actix_utils::timeout::TimeoutError; -use backtrace::Backtrace; #[cfg(feature = "cookies")] use cookie; use derive_more::{Display, From}; @@ -47,7 +46,6 @@ pub type Result = result::Result; /// `ResponseError` reference from it. pub struct Error { cause: Box, - backtrace: Option, } impl Error { @@ -56,18 +54,6 @@ impl Error { self.cause.as_ref() } - /// Returns a reference to the Backtrace carried by this error, if it - /// carries one. - /// - /// This uses the same `Backtrace` type that `failure` uses. - pub fn backtrace(&self) -> &Backtrace { - if let Some(bt) = self.cause.backtrace() { - bt - } else { - self.backtrace.as_ref().unwrap() - } - } - /// Converts error to a response instance and set error message as response body pub fn response_with_message(self) -> Response { let message = format!("{}", self); @@ -84,11 +70,6 @@ pub trait ResponseError: fmt::Debug + fmt::Display { fn error_response(&self) -> Response { Response::new(StatusCode::INTERNAL_SERVER_ERROR) } - - /// Response - fn backtrace(&self) -> Option<&Backtrace> { - None - } } impl fmt::Display for Error { @@ -99,16 +80,7 @@ impl fmt::Display for Error { impl fmt::Debug for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - if let Some(bt) = self.cause.backtrace() { - write!(f, "{:?}\n\n{:?}", &self.cause, bt) - } else { - write!( - f, - "{:?}\n\n{:?}", - &self.cause, - self.backtrace.as_ref().unwrap() - ) - } + write!(f, "{:?}\n", &self.cause) } } @@ -122,14 +94,8 @@ impl From for Response { /// `Error` for any error that implements `ResponseError` impl From for Error { fn from(err: T) -> Error { - let backtrace = if err.backtrace().is_none() { - Some(Backtrace::new()) - } else { - None - }; Error { cause: Box::new(err), - backtrace, } } } @@ -412,7 +378,6 @@ impl ResponseError for ContentTypeError { pub struct InternalError { cause: T, status: InternalErrorType, - backtrace: Backtrace, } enum InternalErrorType { @@ -426,7 +391,6 @@ impl InternalError { InternalError { cause, status: InternalErrorType::Status(status), - backtrace: Backtrace::new(), } } @@ -435,7 +399,6 @@ impl InternalError { InternalError { cause, status: InternalErrorType::Response(RefCell::new(Some(response))), - backtrace: Backtrace::new(), } } } @@ -462,10 +425,6 @@ impl ResponseError for InternalError where T: fmt::Debug + fmt::Display + 'static, { - fn backtrace(&self) -> Option<&Backtrace> { - Some(&self.backtrace) - } - fn error_response(&self) -> Response { match self.status { InternalErrorType::Status(st) => Response::new(st), @@ -922,12 +881,6 @@ mod tests { assert_eq!(format!("{}", e.as_response_error()), "IO error: other"); } - #[test] - fn test_backtrace() { - let e = ErrorBadRequest("err"); - let _ = e.backtrace(); - } - #[test] fn test_error_cause() { let orig = io::Error::new(io::ErrorKind::Other, "other");