ricecoder_commands/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur in the commands system
4#[derive(Error, Debug)]
5pub enum CommandError {
6    #[error("Command not found: {0}")]
7    CommandNotFound(String),
8
9    #[error("Invalid command name: {0}")]
10    InvalidCommandName(String),
11
12    #[error("Invalid argument: {0}")]
13    InvalidArgument(String),
14
15    #[error("Command execution failed: {0}")]
16    ExecutionFailed(String),
17
18    #[error("Template parsing error: {0}")]
19    TemplateError(String),
20
21    #[error("Configuration error: {0}")]
22    ConfigError(String),
23
24    #[error("IO error: {0}")]
25    IoError(#[from] std::io::Error),
26
27    #[error("Serialization error: {0}")]
28    SerializationError(#[from] serde_json::Error),
29
30    #[error("YAML error: {0}")]
31    YamlError(#[from] serde_yaml::Error),
32
33    #[error("Regex error: {0}")]
34    RegexError(#[from] regex::Error),
35
36    #[error("Other error: {0}")]
37    Other(String),
38}
39
40pub type Result<T> = std::result::Result<T, CommandError>;