#[derive(thiserror::Error, Debug)]
pub enum WhynoError {
#[error("{0}")]
Cli(#[from] CliError),
#[error("{0}")]
Output(#[from] OutputError),
#[error("{0}")]
Gather(#[from] whyno_gather::error::GatherError),
#[error("caps: {0}")]
Caps(String),
}
#[derive(thiserror::Error, Debug, PartialEq, Eq)]
pub enum CliError {
#[error("invalid subject format: {0}")]
InvalidSubject(String),
#[error("unknown operation: {0}. Valid: read, write, execute, delete, create, stat")]
InvalidOperation(String),
#[error("--json and --explain are mutually exclusive")]
ConflictingFlags,
#[error("unknown capability: {0}")]
InvalidCap(String),
}
#[derive(thiserror::Error, Debug)]
pub enum OutputError {
#[error("write failed: {0}")]
WriteFailed(#[from] std::io::Error),
#[error("JSON serialization failed: {0}")]
SerializationFailed(#[from] serde_json::Error),
}