fix: Add missing not_found errors
@@ -76,6 +76,18 @@ impl RumaApiError {
_ => None,
}
}
+
+ /// Return whether the error was a 404 not found response.
+ pub fn is_not_found(&self) -> bool {
+ match self {
+ RumaApiError::ClientApi(err) => err.status_code == StatusCode::NOT_FOUND,
+ RumaApiError::Uiaa(UiaaResponse::MatrixError(err)) => {
+ err.status_code == StatusCode::NOT_FOUND
+ }
+ RumaApiError::Uiaa(_) => false,
+ RumaApiError::Other(err) => err.status_code == StatusCode::NOT_FOUND,
+ }
+ }
}
/// An HTTP error, representing either a connection error or an error while
@@ -169,6 +181,9 @@ impl HttpError {
HttpError::Reqwest(err) => err.status() == Some(StatusCode::NOT_FOUND),
HttpError::AuthenticationRequired => false,
HttpError::NotClientRequest => false,
+ HttpError::Api(FromHttpResponseError::Server(ServerError::Known(err))) => {
+ err.is_not_found()
+ }
HttpError::Api(_) => false,
HttpError::IntoHttp(_) => false,
HttpError::Server(status) => *status == StatusCode::NOT_FOUND,
