From 32279c84e09e4a475cf4726ad748de51ed94c516 Mon Sep 17 00:00:00 2001 From: Martin Algesten Date: Fri, 21 Jun 2019 15:14:58 +0200 Subject: [PATCH] impl std::error::Error for Error close #6 --- src/error.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/error.rs b/src/error.rs index 8c5cbed..a25b73e 100644 --- a/src/error.rs +++ b/src/error.rs @@ -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)] @@ -70,3 +71,11 @@ impl From 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 {}