use matrix_sdk_common::executor::JoinError;
use thiserror::Error;
#[derive(Error, Debug)]
#[non_exhaustive]
pub enum Error {
#[error("Sliding sync version is missing")]
VersionIsMissing,
#[error("The sliding sync response could not be handled: {0}")]
BadResponse(String),
#[error(
"The sliding sync list `{0}` is handling a response, \
but its request generator has not been initialized"
)]
RequestGeneratorHasNotBeenInitialized(String),
#[error("Ranges have invalid bounds: `{start}..{end}`")]
InvalidRange {
start: u32,
end: u32,
},
#[error("Unauthenticated user in sliding sync")]
UnauthenticatedUser,
#[error("SlidingSync's internal channel is broken")]
InternalChannelIsBroken,
#[error("The Sliding Sync instance's identifier must be less than 16 chars long")]
InvalidSlidingSyncIdentifier,
#[error(
"A task failed to execute to completion; \
task description: {task_description}, error: {error}"
)]
JoinError {
task_description: String,
error: JoinError,
},
#[cfg(feature = "e2e-encryption")]
#[error("The Olm machine is missing")]
NoOlmMachine,
#[cfg(feature = "e2e-encryption")]
#[error(transparent)]
CryptoStoreError(#[from] matrix_sdk_base::crypto::CryptoStoreError),
}