clap_version_flag/error.rs
1use thiserror::Error;
2
3/// Error type for clap-version-flag
4#[derive(Error, Debug)]
5pub enum VersionError {
6 /// Invalid hex color format
7 #[error("Invalid hex color format: '{0}'. Expected format: #RRGGBB or #RGB")]
8 InvalidHexColor(String),
9
10 /// I/O error
11 #[error("I/O error: {0}")]
12 IoError(#[from] std::io::Error),
13}
14
15impl VersionError {
16 /// Creates a new InvalidHexColor error
17 pub fn invalid_hex(color: &str) -> Self {
18 Self::InvalidHexColor(color.to_string())
19 }
20}