Skip to main content

rhei_cdc_rocksdb/
error.rs

1//! Error types for the RocksDB CDC log.
2//!
3//! All fallible operations on [`crate::RocksDbCdcLog`] return a `Result` whose
4//! error type is [`RocksDbCdcError`]. The most common variant in production is
5//! [`RocksDbCdcError::RocksDb`], which wraps I/O and corruption errors reported
6//! by the underlying RocksDB C++ library.
7
8use thiserror::Error;
9
10/// Errors that can occur in the RocksDB CDC log.
11#[derive(Debug, Error)]
12pub enum RocksDbCdcError {
13    /// RocksDB storage error.
14    #[error("RocksDB error: {0}")]
15    RocksDb(#[from] rust_rocksdb::Error),
16
17    /// Failed to serialize a CDC event.
18    #[error("serialization error: {0}")]
19    Serialization(String),
20
21    /// Failed to deserialize a CDC event.
22    #[error("deserialization error: {0}")]
23    Deserialization(String),
24
25    /// A spawned blocking task failed to join.
26    #[error("task join error: {0}")]
27    Join(String),
28
29    /// Catch-all for other errors.
30    #[error("{0}")]
31    Other(String),
32}