From b5b2eafbecf633df4b5f43f49805f7846d4d613d Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Thu, 3 Nov 2022 09:53:08 +0100 Subject: [PATCH] refactor(base): Remove unused Error variants --- crates/matrix-sdk-base/src/error.rs | 23 +---------------------- crates/matrix-sdk/src/error.rs | 5 ----- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/crates/matrix-sdk-base/src/error.rs b/crates/matrix-sdk-base/src/error.rs index c53eded5b..eb22b20e2 100644 --- a/crates/matrix-sdk-base/src/error.rs +++ b/crates/matrix-sdk-base/src/error.rs @@ -15,11 +15,8 @@ //! Error conditions. -use std::io::Error as IoError; - #[cfg(feature = "e2e-encryption")] -use matrix_sdk_crypto::{CryptoStoreError, MegolmError, OlmError}; -use serde_json::Error as JsonError; +use matrix_sdk_crypto::{CryptoStoreError, OlmError}; use thiserror::Error; /// Result type of the rust-sdk. @@ -29,11 +26,6 @@ pub type Result = std::result::Result; #[non_exhaustive] #[derive(Error, Debug)] pub enum Error { - /// Queried endpoint requires authentication but was called on an anonymous - /// client. - #[error("the queried endpoint requires authentication but was called before logging in")] - AuthenticationRequired, - /// Attempting to restore a session after the olm-machine has already been /// set up fails #[cfg(feature = "e2e-encryption")] @@ -50,14 +42,6 @@ pub enum Error { #[error(transparent)] StateStore(#[from] crate::store::StoreError), - /// An error when (de)serializing JSON. - #[error(transparent)] - SerdeJson(#[from] JsonError), - - /// An error representing IO errors. - #[error(transparent)] - IoError(#[from] IoError), - /// An error occurred in the crypto store. #[cfg(feature = "e2e-encryption")] #[error(transparent)] @@ -67,9 +51,4 @@ pub enum Error { #[cfg(feature = "e2e-encryption")] #[error(transparent)] OlmError(#[from] OlmError), - - /// An error occurred during a E2EE group operation. - #[cfg(feature = "e2e-encryption")] - #[error(transparent)] - MegolmError(#[from] MegolmError), } diff --git a/crates/matrix-sdk/src/error.rs b/crates/matrix-sdk/src/error.rs index 2d2f0a4ac..c1dde2b20 100644 --- a/crates/matrix-sdk/src/error.rs +++ b/crates/matrix-sdk/src/error.rs @@ -306,18 +306,13 @@ impl From> for HttpError { impl From for Error { fn from(e: SdkBaseError) -> Self { match e { - SdkBaseError::AuthenticationRequired => Self::AuthenticationRequired, SdkBaseError::StateStore(e) => Self::StateStore(e), - SdkBaseError::SerdeJson(e) => Self::SerdeJson(e), - SdkBaseError::IoError(e) => Self::Io(e), #[cfg(feature = "e2e-encryption")] SdkBaseError::CryptoStore(e) => Self::CryptoStoreError(e), #[cfg(feature = "e2e-encryption")] SdkBaseError::BadCryptoStoreState => Self::BadCryptoStoreState, #[cfg(feature = "e2e-encryption")] SdkBaseError::OlmError(e) => Self::OlmError(e), - #[cfg(feature = "e2e-encryption")] - SdkBaseError::MegolmError(e) => Self::MegolmError(e), #[cfg(feature = "eyre")] _ => Self::UnknownError(eyre::eyre!(e).into()), #[cfg(all(not(feature = "eyre"), feature = "anyhow"))]