1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, BytePunchError>;
7
8#[derive(Debug, Error)]
10pub enum BytePunchError {
11 #[error("Dictionary error: {0}")]
12 Dictionary(String),
13
14 #[error("Invalid token: {0}")]
15 InvalidToken(String),
16
17 #[error("Compression failed: {0}")]
18 Compression(String),
19
20 #[error("Decompression failed: {0}")]
21 Decompression(String),
22
23 #[error("IO error: {0}")]
24 Io(#[from] std::io::Error),
25
26 #[error("JSON error: {0}")]
27 Json(#[from] serde_json::Error),
28
29 #[error("Invalid magic bytes: expected BP01, got {0:?}")]
30 InvalidMagic([u8; 4]),
31
32 #[error("Unsupported version: {0}")]
33 UnsupportedVersion(u8),
34}