sandbox_runtime/
error.rs

1//! Error types for the sandbox runtime.
2
3use thiserror::Error;
4
5/// Main error type for the sandbox runtime.
6#[derive(Error, Debug)]
7pub enum SandboxError {
8    #[error("Configuration error: {0}")]
9    Config(#[from] ConfigError),
10
11    #[error("Platform not supported: {0}")]
12    UnsupportedPlatform(String),
13
14    #[error("Missing dependency: {0}")]
15    MissingDependency(String),
16
17    #[error("Sandbox execution failed: {0}")]
18    ExecutionFailed(String),
19
20    #[error("Proxy error: {0}")]
21    Proxy(String),
22
23    #[error("I/O error: {0}")]
24    Io(#[from] std::io::Error),
25
26    #[error("Command failed: {0}")]
27    CommandFailed(String),
28
29    #[error("Profile generation error: {0}")]
30    ProfileGeneration(String),
31
32    #[error("Seccomp error: {0}")]
33    Seccomp(String),
34}
35
36/// Configuration-specific errors.
37#[derive(Error, Debug)]
38pub enum ConfigError {
39    #[error("Invalid domain pattern '{pattern}': {reason}")]
40    InvalidDomainPattern { pattern: String, reason: String },
41
42    #[error("Invalid path pattern '{pattern}': {reason}")]
43    InvalidPathPattern { pattern: String, reason: String },
44
45    #[error("File not found: {0}")]
46    FileNotFound(String),
47
48    #[error("Parse error: {0}")]
49    ParseError(String),
50
51    #[error("Validation error: {0}")]
52    ValidationError(String),
53}
54
55pub type Result<T> = std::result::Result<T, SandboxError>;