use thiserror::Error;
#[derive(Error, Debug)]
pub enum AumateError {
#[error("Input error: {0}")]
Input(String),
#[error("Screen error: {0}")]
Screen(String),
#[error("Clipboard error: {0}")]
Clipboard(String),
#[error("Window error: {0}")]
Window(String),
#[error("Screenshot error: {0}")]
Screenshot(String),
#[error("GUI error: {0}")]
Gui(String),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[cfg(feature = "screen")]
#[error("Image error: {0}")]
Image(#[from] image::ImageError),
#[cfg(feature = "ml")]
#[error("ML error: {0}")]
Ml(String),
#[error("{0}")]
Other(String),
}
#[cfg(feature = "ml")]
impl From<candle_core::Error> for AumateError {
fn from(e: candle_core::Error) -> Self {
AumateError::Ml(e.to_string())
}
}
pub type Result<T> = std::result::Result<T, AumateError>;