diff --git a/src/api/errors/api_error.rs b/src/api/errors/api_error.rs index 775f46d509..5e86356459 100644 --- a/src/api/errors/api_error.rs +++ b/src/api/errors/api_error.rs @@ -8,7 +8,7 @@ pub struct ApiError { } /// Represents API errors. -#[derive(Copy, Clone, Eq, PartialEq, Debug, thiserror::Error)] +#[derive(Clone, Eq, PartialEq, Debug, thiserror::Error)] pub(in crate::api) enum ApiErrorKind { #[error("could not serialize value as JSON")] CannotSerializeAsJson, @@ -63,8 +63,8 @@ impl ApiError { } } - pub(in crate::api) fn kind(&self) -> ApiErrorKind { - self.inner + pub(in crate::api) fn kind(&self) -> &ApiErrorKind { + &self.inner } fn set_source>(mut self, source: E) -> ApiError { diff --git a/src/api/mod.rs b/src/api/mod.rs index 93c0e0f2b0..24800dde91 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -311,7 +311,7 @@ impl Api { match self.request(Method::Get, url, None)?.send() { Ok(_) => return Ok(true), Err(err) => { - if err.kind() != ApiErrorKind::RequestFailed { + if err.kind() != &ApiErrorKind::RequestFailed { return Err(err); } } @@ -964,7 +964,7 @@ impl<'a> AuthenticatedApi<'a> { { Ok(options) => Ok(Some(options)), Err(error) => { - if error.kind() == ApiErrorKind::ChunkUploadNotSupported { + if error.kind() == &ApiErrorKind::ChunkUploadNotSupported { Ok(None) } else { Err(error)