use thiserror::Error;
#[derive(Debug, Error)]
pub enum RecogError {
#[error("core error: {0}")]
Core(#[from] crate::core::Error),
#[error("transform error: {0}")]
Transform(#[from] crate::transform::TransformError),
#[error("morphology error: {0}")]
Morph(#[from] crate::morph::MorphError),
#[error("region error: {0}")]
Region(#[from] crate::region::RegionError),
#[error("color error: {0}")]
Color(#[from] crate::color::ColorError),
#[error("unsupported depth: expected {expected}, got {actual}")]
UnsupportedDepth { expected: &'static str, actual: u32 },
#[error("invalid parameter: {0}")]
InvalidParameter(String),
#[error("skew detection failed: {0}")]
SkewDetectionFailed(String),
#[error("segmentation error: {0}")]
SegmentationError(String),
#[error(
"image too small: minimum size is {min_width}x{min_height}, got {actual_width}x{actual_height}"
)]
ImageTooSmall {
min_width: u32,
min_height: u32,
actual_width: u32,
actual_height: u32,
},
#[error("no content found: {0}")]
NoContent(String),
#[error("training error: {0}")]
TrainingError(String),
#[error("identification error: {0}")]
IdentificationError(String),
#[error("classification error: {0}")]
ClassificationError(String),
#[error("dewarping error: {0}")]
DewarpError(String),
#[error("barcode error: {0}")]
BarcodeError(String),
#[error("no barcode found")]
NoBarcodeFound,
#[error("unsupported barcode format: {0}")]
UnsupportedBarcodeFormat(String),
}
pub type RecogResult<T> = Result<T, RecogError>;