diff --git a/crates/matrix-sdk/src/error.rs b/crates/matrix-sdk/src/error.rs index 79c45fcfd..6abd0c112 100644 --- a/crates/matrix-sdk/src/error.rs +++ b/crates/matrix-sdk/src/error.rs @@ -47,7 +47,7 @@ use url::ParseError as UrlParseError; use crate::{ event_cache::EventCacheError, media::MediaError, room::reply::ReplyError, - store_locks::LockStoreError, + sliding_sync::Error as SlidingSyncError, store_locks::LockStoreError, }; /// Result type of the matrix-sdk. @@ -342,7 +342,7 @@ pub enum Error { /// An error occurred within sliding-sync #[error(transparent)] - SlidingSync(#[from] crate::sliding_sync::Error), + SlidingSync(Box), /// Attempted to call a method on a room that requires the user to have a /// specific membership state in the room, but the membership state is @@ -477,6 +477,12 @@ impl From for Error { } } +impl From for Error { + fn from(error: SlidingSyncError) -> Self { + Error::SlidingSync(Box::new(error)) + } +} + /// Error for the room key importing functionality. #[cfg(feature = "e2e-encryption")] #[derive(Error, Debug)] diff --git a/crates/matrix-sdk/src/sliding_sync/builder.rs b/crates/matrix-sdk/src/sliding_sync/builder.rs index 7c40b540b..42434a430 100644 --- a/crates/matrix-sdk/src/sliding_sync/builder.rs +++ b/crates/matrix-sdk/src/sliding_sync/builder.rs @@ -232,7 +232,7 @@ impl SlidingSyncBuilder { let version = self.version.unwrap_or_else(|| client.sliding_sync_version()); if matches!(version, Version::None) { - return Err(crate::error::Error::SlidingSync(Error::VersionIsMissing)); + return Err(crate::error::Error::SlidingSync(Box::new(Error::VersionIsMissing))); } let (internal_channel_sender, _internal_channel_receiver) = channel(8);