1use std::fmt;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
5pub enum CaudalError {
6 InvalidNodeId(String),
8 BufferFull,
10 TransportError(String),
12 SerializationError(String),
14 ValidationError(String),
16}
17
18impl fmt::Display for CaudalError {
19 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20 match self {
21 CaudalError::InvalidNodeId(msg) => write!(f, "Invalid node ID: {}", msg),
22 CaudalError::BufferFull => write!(f, "Event buffer is full"),
23 CaudalError::TransportError(msg) => write!(f, "Transport error: {}", msg),
24 CaudalError::SerializationError(msg) => write!(f, "Serialization error: {}", msg),
25 CaudalError::ValidationError(msg) => write!(f, "Validation error: {}", msg),
26 }
27 }
28}
29
30impl std::error::Error for CaudalError {}
31
32pub type Result<T> = std::result::Result<T, CaudalError>;