1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, QRError>;
7
8#[derive(Error, Debug)]
10pub enum QRError {
11 #[error("No data provided for QR code")]
13 MissingData,
14
15 #[error("Data too large for QR code: data requires more capacity than available")]
17 DataTooLarge,
18
19 #[error("Invalid QR code version: {0}")]
21 InvalidVersion(u8),
22
23 #[error("Canvas dimensions too small: {width}x{height}")]
25 CanvasTooSmall { width: u32, height: u32 },
26
27 #[error("Invalid color format: {0}")]
29 InvalidColor(String),
30
31 #[error("Gradient must have at least one color stop")]
33 EmptyGradient,
34
35 #[error("Failed to load image: {0}")]
37 ImageLoadError(String),
38
39 #[error("Failed to encode image: {0}")]
41 ImageEncodeError(String),
42
43 #[error("IO error: {0}")]
45 IoError(#[from] std::io::Error),
46
47 #[error("Image processing error: {0}")]
49 ImageError(#[from] image::ImageError),
50
51 #[error("QR code generation failed: {0}")]
53 QRGenerationError(String),
54
55 #[error("SVG rendering error: {0}")]
57 SvgError(String),
58}