use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum SandboxError {
#[error("cgroup v2 not available: {0}")]
CgroupUnavailable(String),
#[error("cgroup I/O error: {0}")]
CgroupIo(#[from] std::io::Error),
#[error("cgroup path not writable: {path}")]
CgroupNotWritable {
path: String,
},
#[error("failed to parse /proc/self/cgroup: {0}")]
CgroupParseFailed(String),
#[error("process registry full: max_tracked={max_tracked}")]
RegistryFull {
max_tracked: usize,
},
#[error("process not found: pid={pid}")]
ProcessNotFound {
pid: u32,
},
#[error("OCI runtime '{name}' not found on $PATH")]
RuntimeNotFound {
name: String,
},
#[error("container runtime failed: {reason}")]
RuntimeFailed {
reason: String,
},
#[error("failed to send signal to pid={pid}: {reason}")]
SignalFailed {
pid: u32,
reason: String,
},
#[error("operation denied by approval callback: {operation}")]
ApprovalDenied {
operation: String,
},
#[error("sandbox protocol serialization error: {0}")]
SerdeError(#[from] serde_json::Error),
#[error("operation not supported on this platform: {0}")]
Unsupported(String),
}