Add a general-purpose API error variant to HttpError

master
Jonas Platte 2021-05-08 15:01:02 +02:00
parent 68b74c5ea9
commit 44eff7deb7
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
2 changed files with 10 additions and 4 deletions

View File

@ -19,10 +19,10 @@ use matrix_sdk_base::{Error as MatrixError, StoreError};
use matrix_sdk_common::{
api::{
r0::uiaa::{UiaaInfo, UiaaResponse as UiaaError},
Error as RumaClientError,
Error as RumaClientApiError,
},
identifiers::Error as IdentifierError,
FromHttpResponseError, IntoHttpError, ServerError,
FromHttpResponseError, IntoHttpError, MatrixError as RumaApiError, ServerError,
};
use reqwest::Error as ReqwestError;
use serde_json::Error as JsonError;
@ -55,9 +55,13 @@ pub enum HttpError {
#[error("the queried endpoint is not meant for clients")]
NotClientRequest,
/// An error converting between ruma_*_api types and Hyper types.
#[error(transparent)]
Api(#[from] FromHttpResponseError<RumaApiError>),
/// An error converting between ruma_client_api types and Hyper types.
#[error(transparent)]
ClientApi(#[from] FromHttpResponseError<RumaClientError>),
ClientApi(#[from] FromHttpResponseError<RumaClientApiError>),
/// An error converting between ruma_client_api types and Hyper types.
#[error(transparent)]

View File

@ -3,7 +3,9 @@ pub use instant;
pub use ruma::{
api::{
client as api,
error::{FromHttpRequestError, FromHttpResponseError, IntoHttpError, ServerError},
error::{
FromHttpRequestError, FromHttpResponseError, IntoHttpError, MatrixError, ServerError,
},
AuthScheme, EndpointError, IncomingResponse, OutgoingRequest, SendAccessToken,
},
assign, directory, encryption, events, identifiers, int, presence, push,