use std::io;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum MyError {
#[error("Application error: {0}")]
Application(String),
#[error("Image pipeline error: {0}")]
Pipeline(String),
#[error("Terminal error: {0}")]
Terminal(String),
}
impl From<MyError> for io::Error {
fn from(error: MyError) -> Self {
io::Error::new(io::ErrorKind::Other, error.to_string())
}
}
impl From<io::Error> for MyError {
fn from(error: io::Error) -> Self {
MyError::Application(format!("{error}"))
}
}
impl From<opencv::Error> for MyError {
fn from(error: opencv::Error) -> Self {
MyError::Application(format!("{error}"))
}
}
pub const ERROR_DECODING_IMAGE: &str = "Error decoding image";
pub const ERROR_OPENING_VIDEO: &str = "Error opening video";
pub const ERROR_OPENING_GIF: &str = "Error opening GIF";
pub const ERROR_READING_GIF_HEADER: &str = "Cannot read GIF header";
pub const ERROR_PARSE_DIGIT_FAILED: &str = "Failed to parse digit";
pub const ERROR_CHANNEL: &str = "Error during channel communication";
pub const ERROR_DATA: &str = "Data error";
pub const ERROR_RESIZE: &str = "Image resizing error";