Skip to main content

agentic_sandbox/
error.rs

1//! Sandbox error types.
2
3use thiserror::Error;
4
5/// Errors that can occur during sandbox operations.
6#[derive(Error, Debug)]
7pub enum SandboxError {
8    /// Failed to connect to sandbox runtime
9    #[error("Connection failed: {0}")]
10    ConnectionFailed(String),
11
12    /// Sandbox is not ready
13    #[error("Sandbox not ready: {0}")]
14    NotReady(String),
15
16    /// Sandbox not available (missing prerequisites)
17    #[error("Sandbox not available: {0}")]
18    NotAvailable(String),
19
20    /// Configuration error
21    #[error("Configuration error: {0}")]
22    ConfigError(String),
23
24    /// Failed to create sandbox container/process
25    #[error("Failed to create sandbox: {0}")]
26    CreateFailed(String),
27
28    /// Failed to start sandbox
29    #[error("Failed to start sandbox: {0}")]
30    StartFailed(String),
31
32    /// Start error (alternative)
33    #[error("Start error: {0}")]
34    StartError(String),
35
36    /// Execution timed out
37    #[error("Execution timed out")]
38    Timeout,
39
40    /// Execution failed
41    #[error("Execution failed: {0}")]
42    ExecutionFailed(String),
43
44    /// IO error
45    #[error("IO error: {0}")]
46    IoError(#[from] std::io::Error),
47
48    /// Failed to stop sandbox
49    #[error("Failed to stop sandbox: {0}")]
50    StopFailed(String),
51}