use std::io::Error as IoError;
#[cfg(feature = "e2e-encryption")]
use matrix_sdk_crypto::{CryptoStoreError, MegolmError, OlmError};
use serde_json::Error as JsonError;
use thiserror::Error;
pub type Result<T, E = Error> = std::result::Result<T, E>;
#[non_exhaustive]
#[derive(Error, Debug)]
pub enum Error {
#[error("the queried endpoint requires authentication but was called before logging in")]
AuthenticationRequired,
#[cfg(feature = "e2e-encryption")]
#[error("The olm machine has already been initialized")]
BadCryptoStoreState,
#[error(transparent)]
StateStore(#[from] crate::store::StoreError),
#[error(transparent)]
SerdeJson(#[from] JsonError),
#[error(transparent)]
IoError(#[from] IoError),
#[cfg(feature = "e2e-encryption")]
#[error(transparent)]
CryptoStore(#[from] CryptoStoreError),
#[cfg(feature = "e2e-encryption")]
#[error(transparent)]
OlmError(#[from] OlmError),
#[cfg(feature = "e2e-encryption")]
#[error(transparent)]
MegolmError(#[from] MegolmError),
}