use std::path::PathBuf;
use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error {
#[error("Image load failed: {path}: {reason}")]
ImageLoad {
path: PathBuf,
reason: String,
},
#[error("Codec error ({codec}): {message}")]
Codec {
codec: String,
message: String,
},
#[error("Dimension mismatch: expected {expected:?}, got {actual:?}")]
DimensionMismatch {
expected: (usize, usize),
actual: (usize, usize),
},
#[error("Metric calculation failed: {metric}: {reason}")]
MetricCalculation {
metric: String,
reason: String,
},
#[error("Corpus error: {0}")]
Corpus(String),
#[error("CSV import error at line {line}: {reason}")]
CsvImport {
line: usize,
reason: String,
},
#[error("Invalid quality value: {0} (expected 0.0-100.0 or codec-specific range)")]
InvalidQuality(f64),
#[error("{metric} quality below threshold: {value} (threshold: {threshold})")]
QualityBelowThreshold {
metric: String,
value: f64,
threshold: f64,
},
#[error("Unsupported format: {0}")]
UnsupportedFormat(String),
#[error("Report error: {0}")]
Report(String),
#[error("Cache error: {0}")]
Cache(String),
#[error(transparent)]
Io(#[from] std::io::Error),
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
#[error("CSV error: {0}")]
Csv(#[from] csv::Error),
}