use thiserror::Error;
pub type AgentdResult<T> = Result<T, AgentdError>;
#[derive(Debug, Error)]
pub enum AgentdError {
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("protocol error: {0}")]
Protocol(#[from] microsandbox_protocol::ProtocolError),
#[error("nix error: {0}")]
Nix(#[from] nix::Error),
#[error("json error: {0}")]
Json(#[from] serde_json::Error),
#[error("serial port not found: {0}")]
SerialPortNotFound(String),
#[error("exec session error: {0}")]
ExecSession(String),
#[error("exec spawn failed: {}", .0.message)]
ExecSpawnFailed(microsandbox_protocol::exec::ExecFailed),
#[error("config error: {0}")]
Config(String),
#[error("init error: {0}")]
Init(String),
#[error("shutdown")]
Shutdown,
}