use thiserror::Error;
#[derive(Error, Debug)]
#[non_exhaustive]
pub enum Error {
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("serialization error: {0}")]
Serde(#[from] serde_json::Error),
#[error("pty/transport error: {0}")]
Transport(String),
#[error("command timed out and could not be interrupted; the session was closed - create a new session")]
StillRunning,
#[error("shell exited and closed the session; create a new session (a command ran 'exit', or 'set -e' hit a failing command)")]
ShellExited,
#[error("session is no longer usable (a command could not be interrupted, or the shell exited); create a new session")]
SessionPoisoned,
#[error("blocked by policy: {0}")]
PolicyDenied(String),
#[error("unsupported: {0}")]
Unsupported(String),
#[error("invalid output budget: {0}")]
Budget(String),
}
pub type Result<T> = std::result::Result<T, Error>;