Skip to main content

incident_correlation/
error.rs

1//! Crate-wide error type.
2
3use thiserror::Error;
4
5/// Anything that can go wrong inside the crate.
6#[derive(Debug, Error)]
7pub enum CorrelationError {
8    /// Failed to deserialise the incident card.
9    #[error("invalid incident card: {0}")]
10    InvalidIncident(#[from] serde_json::Error),
11
12    /// An `affected_documents` entry pointed at a node not in the graph.
13    #[error("affected_documents references unknown node id: {0}")]
14    UnknownAffectedNode(String),
15
16    /// An edge tried to point at a node id that wasn't added first.
17    #[error("graph edge points at unknown node id: {0}")]
18    UnknownEdgeTarget(String),
19}