Skip to main content

agentics_storage/
error.rs

1/// Storage-layer failures before conversion to service/API errors.
2#[derive(Debug, thiserror::Error)]
3pub enum StorageError {
4    #[error("{0}")]
5    InvalidKey(String),
6    #[error("{0}")]
7    SymlinkRejected(String),
8    #[error("storage object already exists: {0}")]
9    ObjectConflict(String),
10    #[error("storage object not found: {0}")]
11    ObjectNotFound(String),
12    #[error("{label} exceeds storage byte limit: {actual} > {limit} bytes")]
13    ObjectTooLarge {
14        label: &'static str,
15        actual: u64,
16        limit: u64,
17    },
18    #[error("storage backend error: {0}")]
19    Backend(String),
20    #[error("storage invariant violated: {0}")]
21    Internal(String),
22    #[error("storage IO error: {0}")]
23    Io(#[from] std::io::Error),
24}
25
26pub type Result<T> = std::result::Result<T, StorageError>;