rocketsplash_formats/
error.rs1use thiserror::Error;
8
9#[derive(Debug, Clone, PartialEq, Eq, Error)]
14pub enum FormatError {
15 #[error("width {width} exceeds maximum {max}")]
16 WidthExceeded { width: u32, max: u32 },
17
18 #[error("height {height} exceeds maximum {max}")]
19 HeightExceeded { height: u32, max: u32 },
20
21 #[error("dimensions {width}x{height} overflow")]
22 DimensionOverflow { width: u32, height: u32 },
23
24 #[error("cell count {actual} does not match {width}x{height} (expected {expected})")]
25 CellCountMismatch {
26 actual: usize,
27 expected: usize,
28 width: u32,
29 height: u32,
30 },
31
32 #[error("animation frame {frame} has {actual} cells, expected {expected}")]
33 FrameCellCountMismatch {
34 frame: usize,
35 actual: usize,
36 expected: usize,
37 },
38
39 #[error("animation has {count} frames, exceeds maximum {max}")]
40 FrameCountExceeded { count: usize, max: usize },
41
42 #[error("glyph char count {actual} does not match {width}x{height} (expected {expected})")]
43 GlyphCharCountMismatch {
44 actual: usize,
45 expected: usize,
46 width: u32,
47 height: u32,
48 },
49
50 #[error("glyph opacity length {actual} does not match {width}x{height} (expected {expected})")]
51 GlyphOpacityMismatch {
52 actual: usize,
53 expected: usize,
54 width: u32,
55 height: u32,
56 },
57
58 #[error("font atlas has {count} glyphs, exceeds maximum {max}")]
59 GlyphCountExceeded { count: usize, max: usize },
60
61 #[error("font line height must be non-zero")]
62 ZeroLineHeight,
63
64 #[error("allocation size overflow")]
65 AllocationOverflow,
66
67 #[error("total allocation {requested} exceeds limit {limit} bytes")]
68 AllocationExceeded { requested: usize, limit: usize },
69
70 #[error("serialized payload of {len} bytes exceeds limit {max}")]
71 PayloadTooLarge { len: usize, max: usize },
72
73 #[error("unsupported {format} version {found}; supported {min_supported}..={current}")]
74 UnsupportedVersion {
75 format: &'static str,
76 found: u8,
77 min_supported: u8,
78 current: u8,
79 },
80
81 #[error("decode error: {0}")]
84 Decode(String),
85}
86
87