diff --git a/crates/matrix-sdk/src/sliding_sync/error.rs b/crates/matrix-sdk/src/sliding_sync/error.rs new file mode 100644 index 000000000..658e779ea --- /dev/null +++ b/crates/matrix-sdk/src/sliding_sync/error.rs @@ -0,0 +1,18 @@ +//! Sliding Sync errors. + +use thiserror::Error; + +/// Internal representation of errors in Sliding Sync. +#[derive(Error, Debug)] +#[non_exhaustive] +pub enum Error { + /// The response we've received from the server can't be parsed or doesn't + /// match up with the current expectations on the client side. A + /// `sync`-restart might be required. + #[error("The sliding sync response could not be handled: {0}")] + BadResponse(String), + /// Called `.build()` on a builder type, but the given required field was + /// missing. + #[error("Required field missing: `{0}`")] + BuildMissingField(&'static str), +} diff --git a/crates/matrix-sdk/src/sliding_sync/mod.rs b/crates/matrix-sdk/src/sliding_sync/mod.rs index 33a8b5130..1d12d6dc4 100644 --- a/crates/matrix-sdk/src/sliding_sync/mod.rs +++ b/crates/matrix-sdk/src/sliding_sync/mod.rs @@ -614,6 +614,7 @@ mod builder; mod client; +mod error; mod room; mod view; @@ -630,6 +631,7 @@ use std::{ pub use builder::*; pub use client::*; +pub use error::*; use eyeball::Observable; use futures_core::stream::Stream; pub use room::*; @@ -643,28 +645,12 @@ use ruma::{ assign, OwnedRoomId, RoomId, }; use serde::{Deserialize, Serialize}; -use thiserror::Error; use tracing::{debug, error, info_span, instrument, trace, warn, Instrument, Span}; use url::Url; pub use view::*; use crate::{config::RequestConfig, Client, Result}; -/// Internal representation of errors in Sliding Sync -#[derive(Error, Debug)] -#[non_exhaustive] -pub enum Error { - /// The response we've received from the server can't be parsed or doesn't - /// match up with the current expectations on the client side. A - /// `sync`-restart might be required. - #[error("The sliding sync response could not be handled: {0}")] - BadResponse(String), - /// Called `.build()` on a builder type, but the given required field was - /// missing. - #[error("Required field missing: `{0}`")] - BuildMissingField(&'static str), -} - /// The Entry in the sliding sync room list per sliding sync view #[derive(Clone, Debug, Default, Serialize, Deserialize)] pub enum RoomListEntry {