Skip to main content

rhei_sidecar/
error.rs

1//! Error types for the `rhei-sidecar` crate.
2
3/// Errors produced by the sidecar CDC consumer and its dependencies.
4#[derive(Debug, thiserror::Error)]
5pub enum SidecarError {
6    /// An error returned by the underlying `connector_arrow` query layer
7    /// (e.g. SQL syntax error, connection failure, schema mismatch).
8    #[error("connector error: {0}")]
9    Connector(String),
10
11    /// A Tokio `spawn_blocking` task was dropped before it could produce a
12    /// result, typically because the runtime is shutting down.
13    #[error("task join error: {0}")]
14    Join(String),
15
16    /// A [`crate::WatermarkStore`] operation (load or save) failed.
17    ///
18    /// When raised by [`crate::TimestampCdcConsumer::try_with_watermark_store`]
19    /// at construction time it indicates a corrupt or inaccessible store.
20    /// When raised during a poll cycle the consumer rolls back its in-memory
21    /// watermark so the same rows will be re-fetched on the next poll.
22    #[error("watermark store error: {0}")]
23    WatermarkStore(String),
24
25    /// A catch-all variant for errors that do not fit the other categories.
26    #[error("{0}")]
27    Other(String),
28}
29
30impl From<connector_arrow::ConnectorError> for SidecarError {
31    fn from(e: connector_arrow::ConnectorError) -> Self {
32        SidecarError::Connector(e.to_string())
33    }
34}