Skip to content

Commit

Permalink
impl std::error::Error for Error close fortanix#6
Browse files Browse the repository at this point in the history
  • Loading branch information
algesten committed Jun 21, 2019
1 parent 41b21d3 commit 32279c8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::io::Error as IoError;
use std::fmt;

/// Errors that are translated to ["synthetic" responses](struct.Response.html#method.synthetic).
#[derive(Debug)]
Expand Down Expand Up @@ -70,3 +71,11 @@ impl From<IoError> for Error {
Error::Io(err)
}
}

impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.body_text())
}
}

impl std::error::Error for Error {}

0 comments on commit 32279c8

Please sign in to comment.