Skip to main content

rig_tap/
error.rs

1//! Errors produced by [`crate`] helpers.
2
3/// Errors produced when serializing or processing observability events.
4#[derive(Debug, thiserror::Error)]
5#[non_exhaustive]
6pub enum Error {
7    /// JSON serialization of an event payload failed.
8    #[error("failed to serialize observability event: {0}")]
9    Serialize(#[from] serde_json::Error),
10}
11
12impl Error {
13    /// Returns a short, stable identifier for the error variant. Useful for
14    /// structured logging without leaking the underlying message.
15    pub fn kind(&self) -> &'static str {
16        match self {
17            Error::Serialize(_) => "serialize",
18        }
19    }
20}