pub enum HttpError {
Reqwest(Error),
NotClientRequest,
Api(FromHttpResponseError<RumaApiError>),
IntoHttp(IntoHttpError),
RefreshToken(RefreshTokenError),
}
Expand description
An HTTP error, representing either a connection error or an error while converting the raw HTTP response into a Matrix response.
Variants§
Reqwest(Error)
Error at the HTTP layer.
NotClientRequest
Queried endpoint is not meant for clients.
Api(FromHttpResponseError<RumaApiError>)
API response error (deserialization, or a Matrix-specific error).
IntoHttp(IntoHttpError)
Error when creating an API request (e.g. serialization of body/headers/query parameters).
RefreshToken(RefreshTokenError)
Error while refreshing the access token.
Implementations§
Source§impl HttpError
impl HttpError
Sourcepub fn as_ruma_api_error(&self) -> Option<&RumaApiError>
pub fn as_ruma_api_error(&self) -> Option<&RumaApiError>
Sourcepub fn as_client_api_error(&self) -> Option<&Error>
pub fn as_client_api_error(&self) -> Option<&Error>
Shorthand for
.as_ruma_api_error().and_then(RumaApiError::as_client_api_error)
.
Source§impl HttpError
impl HttpError
Sourcepub fn client_api_error_kind(&self) -> Option<&ErrorKind>
pub fn client_api_error_kind(&self) -> Option<&ErrorKind>
If self
is a server error in the errcode
+ error
format expected
for client-API endpoints, returns the error kind (errcode
).
Sourcepub fn as_uiaa_response(&self) -> Option<&UiaaInfo>
pub fn as_uiaa_response(&self) -> Option<&UiaaInfo>
Try to destructure the error into an universal interactive auth info.
Some requests require universal interactive auth, doing such a request will always fail the first time with a 401 status code, the response body will contain info how the client can authenticate.
The request will need to be retried, this time containing additional authentication data.
This method is an convenience method to get to the info the server returned on the first, failed request.
Trait Implementations§
Source§impl Error for HttpError
impl Error for HttpError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<Error> for HttpError
impl From<Error> for HttpError
Source§fn from(source: ReqwestError) -> Self
fn from(source: ReqwestError) -> Self
Source§impl From<FromHttpResponseError<Error>> for HttpError
impl From<FromHttpResponseError<Error>> for HttpError
Source§fn from(err: FromHttpResponseError<Error>) -> Self
fn from(err: FromHttpResponseError<Error>) -> Self
Source§impl From<FromHttpResponseError<MatrixError>> for HttpError
impl From<FromHttpResponseError<MatrixError>> for HttpError
Source§fn from(err: FromHttpResponseError<MatrixError>) -> Self
fn from(err: FromHttpResponseError<MatrixError>) -> Self
Source§impl From<FromHttpResponseError<RumaApiError>> for HttpError
impl From<FromHttpResponseError<RumaApiError>> for HttpError
Source§fn from(source: FromHttpResponseError<RumaApiError>) -> Self
fn from(source: FromHttpResponseError<RumaApiError>) -> Self
Source§impl From<FromHttpResponseError<UiaaResponse>> for HttpError
impl From<FromHttpResponseError<UiaaResponse>> for HttpError
Source§fn from(err: FromHttpResponseError<UiaaResponse>) -> Self
fn from(err: FromHttpResponseError<UiaaResponse>) -> Self
Source§impl From<HttpError> for ClientBuildError
impl From<HttpError> for ClientBuildError
Auto Trait Implementations§
impl !Freeze for HttpError
impl !RefUnwindSafe for HttpError
impl Send for HttpError
impl Sync for HttpError
impl Unpin for HttpError
impl !UnwindSafe for HttpError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more