Skip to content

Commit 9215c3e

Browse files
committed
Fix stack overflow on display error
1 parent 5500b6f commit 9215c3e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/errors.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use reqwest::Error as HttpError;
33
use reqwest::StatusCode;
44
use serde_json::error::Error as SerdeError;
55
use std::io::Error as IoError;
6+
use std::error::Error as StdError;
67

78
// Ours
89
use Errors;
@@ -57,12 +58,12 @@ impl ::std::fmt::Display for Error {
5758
ref code,
5859
ref errors,
5960
} => writeln!(f, "Jira Client Error ({}):\n{:#?}", code, errors),
60-
_ => writeln!(f, "Could not connect to Jira: {}!", self),
61+
_ => writeln!(f, "Could not connect to Jira: {}", self.description()),
6162
}
6263
}
6364
}
6465

65-
impl ::std::error::Error for Error {
66+
impl StdError for Error {
6667
fn description(&self) -> &str {
6768
use Error::*;
6869

@@ -77,7 +78,7 @@ impl ::std::error::Error for Error {
7778
}
7879
}
7980

80-
fn cause(&self) -> Option<&::std::error::Error> {
81+
fn cause(&self) -> Option<&StdError> {
8182
use Error::*;
8283

8384
match *self {

0 commit comments

Comments
 (0)