Skip to main content

aios_protocol/
error.rs

1//! Error types for the Agent OS protocol.
2
3use thiserror::Error;
4
5/// Errors that can occur in kernel operations.
6#[derive(Debug, Error)]
7pub enum KernelError {
8    #[error("capability denied: {0}")]
9    CapabilityDenied(String),
10    #[error("tool not found: {0}")]
11    ToolNotFound(String),
12    #[error("approval required: {0}")]
13    ApprovalRequired(String),
14    #[error("io error: {0}")]
15    Io(String),
16    #[error("serialization error: {0}")]
17    Serialization(String),
18    #[error("invalid state: {0}")]
19    InvalidState(String),
20    #[error("runtime error: {0}")]
21    Runtime(String),
22    #[error("budget exceeded: {0}")]
23    BudgetExceeded(String),
24    #[error("sequence conflict: expected {expected}, got {actual}")]
25    SequenceConflict { expected: u64, actual: u64 },
26}
27
28/// Convenience result type for kernel operations.
29pub type KernelResult<T> = Result<T, KernelError>;