1use std::fmt::Display;
2use std::io;
3
4#[derive(Debug)]
5pub enum CliError {
6 NoPrompt,
7 ConflictingArgs(String),
8 ModelError(String),
9 McpError(String),
10 IoError(io::Error),
11 AgentError(String),
12}
13
14impl Display for CliError {
15 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16 match self {
17 Self::NoPrompt => write!(
18 f,
19 "No prompt provided. Pass a prompt as an argument or pipe via stdin."
20 ),
21 Self::ConflictingArgs(e) => write!(f, "{e}"),
22 Self::ModelError(e) => write!(f, "Model error: {e}"),
23 Self::McpError(e) => write!(f, "MCP error: {e}"),
24 Self::IoError(e) => write!(f, "IO error: {e}"),
25 Self::AgentError(e) => write!(f, "Agent error: {e}"),
26 }
27 }
28}
29
30impl std::error::Error for CliError {}