Skip to main content

rhei_sync/
error.rs

1//! Error types for the CDC sync pipeline.
2
3use thiserror::Error;
4
5/// Errors that can occur during CDC-to-OLAP synchronisation.
6#[derive(Debug, Error)]
7pub enum SyncError {
8    /// An error returned by the CDC consumer (e.g. polling or pruning failed).
9    #[error("CDC consumer error: {0}")]
10    Cdc(String),
11
12    /// An error returned by the OLAP engine while executing DML or loading Arrow data.
13    #[error("OLAP engine error: {0}")]
14    Olap(String),
15
16    /// A schema-registry error (e.g. table not registered, reserved column name).
17    ///
18    /// Converted automatically from [`rhei_core::CoreError`].
19    #[error("schema error: {0}")]
20    Schema(#[from] rhei_core::CoreError),
21
22    /// A CDC event could not be converted to DML (e.g. missing primary key, NULL PK value).
23    #[error("conversion error: {0}")]
24    Conversion(String),
25
26    /// A column type in the CDC event or Arrow schema is not supported by the
27    /// Arrow batch path.  The caller should fall back to the SQL path.
28    #[error("unsupported type in CDC event: {0}")]
29    UnsupportedType(String),
30
31    /// JSON serialisation / deserialisation failed.
32    ///
33    /// Converted automatically from [`serde_json::Error`].
34    #[error("serialization error: {0}")]
35    Serialization(#[from] serde_json::Error),
36
37    /// A catch-all variant for errors that do not fit the categories above.
38    #[error("{0}")]
39    Other(String),
40}