use thiserror::Error;
pub type InkjetResult<T> = Result<T, InkjetError>;
#[derive(Debug, Error)]
pub enum InkjetError {
#[error("internal tree-sitter error: {0}")]
TreeSitter(#[from] tree_sitter_highlight::Error),
#[error("formatting error: {0}")]
Fmt(#[from] std::fmt::Error),
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[cfg(feature = "theme")]
#[error("Theme error: {0}")]
Theme(#[from] ThemeError)
}
#[cfg(feature = "theme")]
#[derive(Debug, Error)]
pub enum ThemeError {
#[error("TOML deserialization error: {0}")]
Toml(#[from] toml::de::Error),
#[error("malformed hex code: {0}")]
InvalidHexCode(String),
#[error("malformed hex byte: {0}")]
InvalidHexByte(#[from] std::num::ParseIntError),
#[error("invalid underline style: {0}")]
InvalidUnderlineStyle(String),
#[error("invalid modifier: {0}")]
InvalidModifier(String),
#[error("dangling color reference: {0}")]
DanglingColorReference(String),
}