api: Rename FromHttpResponseError::{Http => Server}
This commit is contained in:
parent
54f9db8ccc
commit
ffd7625a17
@ -131,21 +131,21 @@ pub enum FromHttpResponseError<E> {
|
|||||||
Deserialization(DeserializationError),
|
Deserialization(DeserializationError),
|
||||||
|
|
||||||
/// The server returned a non-success status
|
/// The server returned a non-success status
|
||||||
Http(ServerError<E>),
|
Server(ServerError<E>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E: fmt::Display> fmt::Display for FromHttpResponseError<E> {
|
impl<E: fmt::Display> fmt::Display for FromHttpResponseError<E> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::Deserialization(err) => write!(f, "deserialization failed: {}", err),
|
Self::Deserialization(err) => write!(f, "deserialization failed: {}", err),
|
||||||
Self::Http(err) => write!(f, "the server returned an error: {}", err),
|
Self::Server(err) => write!(f, "the server returned an error: {}", err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E> From<ServerError<E>> for FromHttpResponseError<E> {
|
impl<E> From<ServerError<E>> for FromHttpResponseError<E> {
|
||||||
fn from(err: ServerError<E>) -> Self {
|
fn from(err: ServerError<E>) -> Self {
|
||||||
Self::Http(err)
|
Self::Server(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ impl IncomingResponse for Response {
|
|||||||
if http_response.status().as_u16() < 400 {
|
if http_response.status().as_u16() < 400 {
|
||||||
Ok(Response)
|
Ok(Response)
|
||||||
} else {
|
} else {
|
||||||
Err(FromHttpResponseError::Http(ServerError::Known(
|
Err(FromHttpResponseError::Server(ServerError::Known(
|
||||||
<MatrixError as EndpointError>::try_from_http_response(http_response)?,
|
<MatrixError as EndpointError>::try_from_http_response(http_response)?,
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user