Skip to main content

agentstategraph_core/
error.rs

1//! Error types for agentstategraph-core.
2
3use crate::path::PathError;
4
5/// Errors that can occur in agentstategraph-core operations.
6#[derive(Debug, thiserror::Error)]
7pub enum CoreError {
8    #[error("object not found: {0}")]
9    ObjectNotFound(String),
10
11    #[error("invalid path: {0}")]
12    InvalidPath(#[from] PathError),
13
14    #[error("path does not exist in state tree: {0}")]
15    PathNotFound(String),
16
17    #[error("type mismatch at path {path}: expected {expected}, found {found}")]
18    TypeMismatch {
19        path: String,
20        expected: String,
21        found: String,
22    },
23
24    #[error("index {index} out of bounds for list of length {length}")]
25    IndexOutOfBounds { index: usize, length: usize },
26
27    #[error("cannot navigate into atom value at path: {0}")]
28    CannotNavigateAtom(String),
29
30    #[error("serialization error: {0}")]
31    Serialization(String),
32}