agentfs/
error.rs

1//! Error types for AgentFS
2
3use thiserror::Error;
4
5/// Result type for AgentFS operations
6pub type Result<T> = std::result::Result<T, AgentFsError>;
7
8/// Error types for AgentFS operations
9#[derive(Error, Debug)]
10pub enum AgentFsError {
11    #[error("File not found: {0}")]
12    FileNotFound(String),
13
14    #[error("Directory not found: {0}")]
15    DirectoryNotFound(String),
16
17    #[error("Path already exists: {0}")]
18    PathExists(String),
19
20    #[error("Invalid path: {0}")]
21    InvalidPath(String),
22
23    #[error("Path traversal attempt: {0}")]
24    PathTraversal(String),
25
26    #[error("Database error: {0}")]
27    Database(#[from] agentdb::AgentDbError),
28
29    #[error("Serialization error: {0}")]
30    Serialization(#[from] serde_json::Error),
31
32    #[error("IO error: {0}")]
33    Io(#[from] std::io::Error),
34
35    #[error(transparent)]
36    Other(#[from] Box<dyn std::error::Error + Send + Sync>),
37}