humor/
error.rs

1use std::io;
2use std::path::PathBuf;
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum HumorError {
7    #[error("IO error: {0}")]
8    Io(#[from] io::Error),
9
10    #[error("YAML parsing error: {0}")]
11    YamlParsing(#[from] serde_yaml::Error),
12
13    #[error("File not found: {0}")]
14    FileNotFound(PathBuf),
15
16    #[error("Duplicate command found: {domain}.{command}")]
17    DuplicateCommand { domain: String, command: String },
18
19    #[error("Command not found: {0}")]
20    CommandNotFound(String),
21
22    #[error("Invalid command structure")]
23    InvalidCommandStructure,
24
25    #[error("Command execution failed")]
26    CommandExecutionFailed,
27}
28
29pub type HumorResult<T> = Result<T, HumorError>;