Add error types and core image types: ImageFormat, ImageSource, Dimensions, QualityPreset

This commit is contained in:
2026-03-06 01:37:39 +02:00
parent dab049b0d3
commit 3e176e3d65
4 changed files with 303 additions and 2 deletions

View File

@@ -1 +1,27 @@
// Error types
use std::path::PathBuf;
#[derive(Debug, thiserror::Error)]
pub enum PixstripError {
#[error("Failed to load image '{path}': {reason}")]
ImageLoad { path: PathBuf, reason: String },
#[error("Unsupported format: {format}")]
UnsupportedFormat { format: String },
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("Output file already exists: {path}")]
OutputExists { path: PathBuf },
#[error("Processing error in '{operation}': {reason}")]
Processing { operation: String, reason: String },
#[error("Preset error: {0}")]
Preset(String),
#[error("Configuration error: {0}")]
Config(String),
}
pub type Result<T> = std::result::Result<T, PixstripError>;