Skip to main content

yoagent_state/
error.rs

1use crate::{EventId, NodeId};
2use thiserror::Error;
3
4#[derive(Debug, Error)]
5pub enum StateError {
6    #[error("event not found: {0}")]
7    EventNotFound(EventId),
8
9    #[error("node not found: {0}")]
10    NodeNotFound(NodeId),
11
12    #[error("invalid event payload for {kind}: {source}")]
13    InvalidEventPayload {
14        kind: String,
15        source: serde_json::Error,
16    },
17
18    #[error("io error: {0}")]
19    Io(#[from] std::io::Error),
20
21    #[error("json error: {0}")]
22    Json(#[from] serde_json::Error),
23
24    #[error("store error: {0}")]
25    Store(String),
26
27    #[error("validation error: {0}")]
28    Validation(String),
29
30    #[error("policy denied: {0}")]
31    PolicyDenied(String),
32}