Skip to main content

oxigdal_streaming/
error.rs

1//! Error types for the streaming module.
2
3/// Result type for streaming operations.
4pub type Result<T> = std::result::Result<T, StreamingError>;
5
6/// Errors that can occur during streaming operations.
7#[derive(Debug, thiserror::Error)]
8pub enum StreamingError {
9    /// Core OxiGDAL error
10    #[error("OxiGDAL error: {0}")]
11    Core(#[from] oxigdal_core::error::OxiGdalError),
12
13    /// Stream is closed
14    #[error("Stream is closed")]
15    StreamClosed,
16
17    /// Stream buffer full
18    #[error("Stream buffer is full")]
19    BufferFull,
20
21    /// Invalid window configuration
22    #[error("Invalid window configuration: {0}")]
23    InvalidWindow(String),
24
25    /// Watermark error
26    #[error("Watermark error: {0}")]
27    WatermarkError(String),
28
29    /// State error
30    #[error("State error: {0}")]
31    StateError(String),
32
33    /// Checkpoint error
34    #[error("Checkpoint error: {0}")]
35    CheckpointError(String),
36
37    /// Partition error
38    #[error("Partition error: {0}")]
39    PartitionError(String),
40
41    /// Join error
42    #[error("Join error: {0}")]
43    JoinError(String),
44
45    /// Serialization error
46    #[error("Serialization error: {0}")]
47    SerializationError(String),
48
49    /// Deserialization error
50    #[error("Deserialization error: {0}")]
51    DeserializationError(String),
52
53    /// RocksDB error
54    #[cfg(feature = "rocksdb-backend")]
55    #[error("RocksDB error: {0}")]
56    RocksDB(#[from] rocksdb::Error),
57
58    /// IO error
59    #[error("IO error: {0}")]
60    Io(#[from] std::io::Error),
61
62    /// Arrow error
63    #[error("Arrow error: {0}")]
64    Arrow(#[from] arrow::error::ArrowError),
65
66    /// Send error
67    #[error("Channel send error")]
68    SendError,
69
70    /// Receive error
71    #[error("Channel receive error")]
72    RecvError,
73
74    /// Timeout error
75    #[error("Operation timed out")]
76    Timeout,
77
78    /// Invalid state
79    #[error("Invalid state: {0}")]
80    InvalidState(String),
81
82    /// Configuration error
83    #[error("Configuration error: {0}")]
84    ConfigError(String),
85
86    /// Invalid operation
87    #[error("Invalid operation: {0}")]
88    InvalidOperation(String),
89
90    /// Not implemented
91    #[error("Not implemented: {0}")]
92    NotImplemented(String),
93
94    /// Other error
95    #[error("Other error: {0}")]
96    Other(String),
97}
98
99impl<T> From<crossbeam_channel::SendError<T>> for StreamingError {
100    fn from(_: crossbeam_channel::SendError<T>) -> Self {
101        StreamingError::SendError
102    }
103}
104
105impl From<crossbeam_channel::RecvError> for StreamingError {
106    fn from(_: crossbeam_channel::RecvError) -> Self {
107        StreamingError::RecvError
108    }
109}
110
111impl From<serde_json::Error> for StreamingError {
112    fn from(e: serde_json::Error) -> Self {
113        StreamingError::SerializationError(e.to_string())
114    }
115}