Skip to main content

samod_core/actors/document/
errors.rs

1use std::fmt;
2
3/// Errors that can occur during document operations.
4#[derive(Debug, Clone, PartialEq, Eq)]
5pub enum DocumentError {
6    /// Document is not yet ready for operations (not loaded).
7    DocumentNotReady,
8    InvalidState(String),
9}
10
11impl fmt::Display for DocumentError {
12    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13        match self {
14            DocumentError::DocumentNotReady => {
15                write!(f, "Document is not yet ready for operations")
16            }
17            DocumentError::InvalidState(msg) => {
18                write!(f, "Invalid state: {msg}")
19            }
20        }
21    }
22}
23
24impl std::error::Error for DocumentError {}