From 5ad4fd11c95348f5504002ec2f148e421563ed5c Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 22 May 2020 17:24:18 +0200 Subject: [PATCH] Improve Display implementation for Error --- src/error.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/error.rs b/src/error.rs index 4fa8bd61..f517d2d2 100644 --- a/src/error.rs +++ b/src/error.rs @@ -20,7 +20,7 @@ pub enum Error { FromHttpResponse(FromHttpResponseError), } -impl Display for Error { +impl Display for Error { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match self { Self::AuthenticationRequired => { @@ -29,9 +29,7 @@ impl Display for Error { Self::IntoHttp(err) => write!(f, "HTTP request construction failed: {}", err), Self::Url(UrlError(err)) => write!(f, "Invalid URL: {}", err), Self::Response(ResponseError(err)) => write!(f, "Couldn't obtain a response: {}", err), - // FIXME: ruma-client-api's Error type currently doesn't implement - // `Display`, update this when it does. - Self::FromHttpResponse(_) => write!(f, "HTTP response conversion failed"), + Self::FromHttpResponse(err) => write!(f, "HTTP response conversion failed: {}", err), } } } @@ -62,7 +60,7 @@ impl From> for Error { } } -impl std::error::Error for Error {} +impl std::error::Error for Error {} #[derive(Debug)] pub struct UrlError(http::uri::InvalidUri);