#[cfg(not(feature = "std"))]
use alloc::string::String;
pub type Result<T> = core::result::Result<T, StreamingError>;
#[derive(Debug, thiserror::Error)]
pub enum StreamingError {
#[cfg(feature = "std")]
#[error("OxiGDAL error: {0}")]
Core(#[from] oxigdal_core::error::OxiGdalError),
#[error("Stream is closed")]
StreamClosed,
#[error("Stream buffer is full")]
BufferFull,
#[error("Invalid window configuration: {0}")]
InvalidWindow(String),
#[error("Watermark error: {0}")]
WatermarkError(String),
#[error("State error: {0}")]
StateError(String),
#[error("Checkpoint error: {0}")]
CheckpointError(String),
#[error("Partition error: {0}")]
PartitionError(String),
#[error("Join error: {0}")]
JoinError(String),
#[error("Serialization error: {0}")]
SerializationError(String),
#[error("Deserialization error: {0}")]
DeserializationError(String),
#[cfg(feature = "rocksdb-backend")]
#[error("RocksDB error: {0}")]
RocksDB(#[from] rocksdb::Error),
#[cfg(feature = "std")]
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[cfg(feature = "std")]
#[error("Arrow error: {0}")]
Arrow(#[from] arrow::error::ArrowError),
#[error("Channel send error")]
SendError,
#[error("Channel receive error")]
RecvError,
#[error("Operation timed out")]
Timeout,
#[error("Invalid state: {0}")]
InvalidState(String),
#[error("Configuration error: {0}")]
ConfigError(String),
#[error("Invalid operation: {0}")]
InvalidOperation(String),
#[error("Not implemented: {0}")]
NotImplemented(String),
#[error("Other error: {0}")]
Other(String),
}
#[cfg(feature = "std")]
impl<T> From<crossbeam_channel::SendError<T>> for StreamingError {
fn from(_: crossbeam_channel::SendError<T>) -> Self {
StreamingError::SendError
}
}
#[cfg(feature = "std")]
impl From<crossbeam_channel::RecvError> for StreamingError {
fn from(_: crossbeam_channel::RecvError) -> Self {
StreamingError::RecvError
}
}
#[cfg(feature = "std")]
impl From<serde_json::Error> for StreamingError {
fn from(e: serde_json::Error) -> Self {
StreamingError::SerializationError(e.to_string())
}
}