Skip to main content

agent_guard/
error.rs

1//! Error types for agent-guard.
2use thiserror::Error;
3
4/// Errors that can occur in agent-guard operations.
5#[derive(Debug, Error)]
6pub enum Error {
7    #[error("BPF LSM not available: {0}")]
8    BpfNotAvailable(String),
9
10    #[error("cgroup v2 not available: {0}")]
11    CgroupNotAvailable(String),
12
13    #[error("Landlock not available: {0}")]
14    LandlockNotAvailable(String),
15
16    #[error("seccomp not available: {0}")]
17    SeccompNotAvailable(String),
18
19    #[error("eBPF not available: {0}")]
20    EbpfNotAvailable(String),
21
22    #[error("Security operation failed: {0}")]
23    SecurityOperation(String),
24
25    #[error("Guard not initialized")]
26    NotInitialized,
27
28    #[error("Invalid configuration: {0}")]
29    InvalidConfig(String),
30
31    #[error("MCP broker error: {0}")]
32    McpBroker(String),
33}
34
35/// Result type alias for agent-guard operations.
36pub type Result<T> = std::result::Result<T, Error>;