sdk: prefer direct use of IntoHttp ctor instead of implicit #[from] conversions

This commit is contained in:
Benjamin Bouvier
2024-06-13 17:28:10 +02:00
parent c33a7b77e1
commit c656ad4068
4 changed files with 6 additions and 5 deletions

View File

@@ -96,7 +96,7 @@ fn response_to_error(status: StatusCode, body: Vec<u8>) -> HttpError {
error.into()
}
Err(e) => e.into(),
Err(e) => HttpError::IntoHttp(e),
}
}

View File

@@ -98,7 +98,7 @@ pub enum HttpError {
/// An error converting between ruma_client_api types and Hyper types.
#[error(transparent)]
IntoHttp(#[from] IntoHttpError),
IntoHttp(IntoHttpError),
/// An error occurred while refreshing the access token.
#[error(transparent)]

View File

@@ -150,8 +150,9 @@ impl HttpClient {
}
}
let request =
self.serialize_request(request, config, homeserver, access_token, server_versions)?;
let request = self
.serialize_request(request, config, homeserver, access_token, server_versions)
.map_err(HttpError::IntoHttp)?;
let method = request.method();

View File

@@ -132,7 +132,7 @@ impl MatrixAuth {
match request {
Ok(req) => Ok(req.uri().to_string()),
Err(err) => Err(Error::from(HttpError::from(err))),
Err(err) => Err(Error::from(HttpError::IntoHttp(err))),
}
}