mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-18 13:40:55 -04:00
refactor(base): Remove unused Error variants
This commit is contained in:
committed by
Jonas Platte
parent
27b0ea1aa0
commit
b5b2eafbec
@@ -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<T, E = Error> = std::result::Result<T, E>;
|
||||
#[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),
|
||||
}
|
||||
|
||||
@@ -306,18 +306,13 @@ impl From<FromHttpResponseError<ruma::api::error::MatrixError>> for HttpError {
|
||||
impl From<SdkBaseError> 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"))]
|
||||
|
||||
Reference in New Issue
Block a user