glyph_core/
error.rs

1use std::io;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5pub enum GlyphError {
6    #[error("IO error: {0}")]
7    Io(#[from] io::Error),
8
9    #[error("Invalid magic number")]
10    InvalidMagic,
11
12    #[error("Invalid format version")]
13    InvalidVersion,
14
15    #[error("Invalid frame dimensions: width={width}, height={height}")]
16    InvalidDimensions { width: u32, height: u32 },
17
18    #[error("Compression error: {0}")]
19    CompressionError(String),
20
21    #[error("Decompression error: {0}")]
22    DecompressionError(String),
23
24    #[error("Frame data error: {0}")]
25    FrameDataError(String),
26
27    #[error("Invalid frame index: {0}")]
28    InvalidFrameIndex(usize),
29
30    #[error("Other error: {0}")]
31    Other(String),
32}
33
34pub type Result<T> = std::result::Result<T, GlyphError>;