From 9215c3e796540e1cf64f0ca7413916389682ad0a Mon Sep 17 00:00:00 2001 From: Aceeri Date: Mon, 22 Oct 2018 16:49:35 -0700 Subject: [PATCH] Fix stack overflow on display error --- src/errors.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index 28fbe19..179d4b2 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -3,6 +3,7 @@ use reqwest::Error as HttpError; use reqwest::StatusCode; use serde_json::error::Error as SerdeError; use std::io::Error as IoError; +use std::error::Error as StdError; // Ours use Errors; @@ -57,12 +58,12 @@ impl ::std::fmt::Display for Error { ref code, ref errors, } => writeln!(f, "Jira Client Error ({}):\n{:#?}", code, errors), - _ => writeln!(f, "Could not connect to Jira: {}!", self), + _ => writeln!(f, "Could not connect to Jira: {}", self.description()), } } } -impl ::std::error::Error for Error { +impl StdError for Error { fn description(&self) -> &str { use Error::*; @@ -77,7 +78,7 @@ impl ::std::error::Error for Error { } } - fn cause(&self) -> Option<&::std::error::Error> { + fn cause(&self) -> Option<&StdError> { use Error::*; match *self {