Skip to main content

lighty_launch/instance/
errors.rs

1use thiserror::Error;
2
3/// Result type for instance operations
4pub type InstanceResult<T> = Result<T, InstanceError>;
5
6/// Errors that can occur during instance management
7#[derive(Debug, Error)]
8pub enum InstanceError {
9    #[error("Instance with PID {pid} not found")]
10    NotFound { pid: u32 },
11
12    #[error("Cannot delete instance '{instance_name}': still running with PIDs {pids:?}")]
13    StillRunning {
14        instance_name: String,
15        pids: Vec<u32>,
16    },
17
18    #[error("I/O error: {0}")]
19    Io(#[from] std::io::Error),
20
21    #[error("Cannot register instance: PID {pid} already tracked by '{existing_instance}'")]
22    DuplicatePid {
23        pid: u32,
24        existing_instance: String,
25    },
26
27    #[error("Failed to kill PID {pid}: {reason}")]
28    KillFailed { pid: u32, reason: String },
29}