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 {