Skip to main content

narrative_graph/
error.rs

1use std::fmt;
2
3#[derive(Debug)]
4pub enum NarrativeGraphError {
5    InvalidConfidenceThreshold(f32),
6}
7
8impl fmt::Display for NarrativeGraphError {
9    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
10        match self {
11            NarrativeGraphError::InvalidConfidenceThreshold(value) => write!(
12                f,
13                "Confidence threshold must be between 0.0 and 1.0, got {value}"
14            ),
15        }
16    }
17}
18
19impl std::error::Error for NarrativeGraphError {}
20
21pub type Result<T> = std::result::Result<T, NarrativeGraphError>;