From c0e1ff1734d15c774a2c52da95d71e441ff12da1 Mon Sep 17 00:00:00 2001 From: Devin R Date: Thu, 16 Apr 2020 15:20:36 -0400 Subject: [PATCH] async_client/error: dont swallow response error in `AsyncClient::send` --- src/async_client.rs | 2 +- src/error.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/async_client.rs b/src/async_client.rs index 5e298a8b..3fc8a648 100644 --- a/src/async_client.rs +++ b/src/async_client.rs @@ -827,7 +827,7 @@ impl AsyncClient { let body = response.bytes().await?.as_ref().to_owned(); let http_response = http_response.body(body).unwrap(); let response = ::Incoming::try_from(http_response) - .expect("Can't convert http response into ruma response"); + .map_err(|e| Error::LoginError(format!("{:?}", e)))?; Ok(response) } diff --git a/src/error.rs b/src/error.rs index 817baae9..4e8c40b4 100644 --- a/src/error.rs +++ b/src/error.rs @@ -47,9 +47,12 @@ pub enum Error { #[error("can't convert between ruma_client_api and hyper types.")] IntoHttp(RumaIntoHttpError), #[cfg(feature = "encryption")] - /// An error occured durring a E2EE operation. + /// An error occurred during a E2EE operation. #[error(transparent)] OlmError(#[from] OlmError), + /// An error occurred during log in. + #[error("can't login {0}.")] + LoginError(String), } impl From> for Error {