use hyper::StatusCode;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("Failed to generate UUID: {0}")]
Uuid(#[from] uuid::Error),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Hyper error: {0}")]
Hyper(#[from] hyper::Error),
#[error("HTTP error: {0}")]
Http(#[from] hyper::http::Error),
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
#[error("Integral type conversion error: {0}")]
TryFromIntError(#[from] std::num::TryFromIntError),
#[error("Task join error: {0}")]
JoinError(#[from] tokio::task::JoinError),
#[error("Invalid Jailer executable path specified")]
InvalidJailerExecPath,
#[error("Invalid initrd path specified")]
InvalidInitrdPath,
#[error("Invalid socket path specified")]
InvalidSocketPath,
#[error("Invalid drive path specified")]
InvalidDrivePath,
#[error("Invalid chroot base path specified")]
InvalidChrootBasePath,
#[error("Firecracker API call failed with status={status}, body={body:?}")]
FirecrackerAPIError {
status: StatusCode,
body: Option<String>,
},
#[error("Process not started")]
ProcessNotStarted,
#[error("Process not running for pid: {0}")]
ProcessNotRunning(i32),
#[error("Process not killed for pid: {0}")]
ProcessNotKilled(i32),
#[error("Process exited immediatelly with status: {exit_status}")]
ProcessExitedImmediatelly {
exit_status: std::process::ExitStatus,
},
}