Skip to main content

lc_core/observability/
error.rs

1// lc-core/src/observability/error.rs
2//! Export error type for the observability layer.
3
4use std::fmt;
5
6/// Export error. Implementations surface failures through this and the framework
7/// layer only logs a `warn` — it never propagates into the main flow.
8#[derive(Debug)]
9#[non_exhaustive]
10pub enum ObsError {
11    /// Transport failure (I/O, network, database).
12    Transport(String),
13    /// Serialization failure.
14    Encode(String),
15}
16
17impl fmt::Display for ObsError {
18    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19        match self {
20            ObsError::Transport(msg) => write!(f, "observability transport error: {msg}"),
21            ObsError::Encode(msg) => write!(f, "observability encode error: {msg}"),
22        }
23    }
24}
25
26impl std::error::Error for ObsError {}