1use thiserror::Error;
20
21pub type Result<T> = std::result::Result<T, ParxError>;
23
24#[derive(Error, Debug)]
26pub enum ParxError {
27 #[error("invalid magic: expected PARX, got {0:?}")]
29 InvalidMagic([u8; 4]),
30
31 #[error("unsupported version: {major}.{minor}")]
33 UnsupportedVersion { major: u8, minor: u8 },
34
35 #[error("file too small: {size} bytes, minimum is {minimum}")]
37 FileTooSmall { size: usize, minimum: usize },
38
39 #[error("manifest CRC32C mismatch: expected {expected:#010x}, got {actual:#010x}")]
41 ManifestChecksumMismatch { expected: u32, actual: u32 },
42
43 #[error("footer checksum mismatch")]
45 FooterChecksumMismatch,
46
47 #[error("page index checksum mismatch")]
48 PageIndexChecksumMismatch,
49
50 #[error("failed to decode manifest: {0}")]
52 ManifestDecode(#[from] prost::DecodeError),
53
54 #[error("invalid payload bounds: offset {offset}, length {length}, file size {file_size}")]
56 InvalidPayloadBounds {
57 offset: u64,
58 length: u64,
59 file_size: u64,
60 },
61
62 #[error("invalid format: {0}")]
64 InvalidFormat(String),
65
66 #[error("compression error: {0}")]
68 CompressionError(String),
69
70 #[error("invalid bundle magic: expected PRXB, got {0:?}")]
72 InvalidBundleMagic([u8; 4]),
73
74 #[error("invalid Parquet magic bytes (expected PAR1, got {0:?})")]
76 InvalidParquetMagic([u8; 4]),
77
78 #[error("Parquet footer length {footer_len} exceeds file size {file_size}")]
80 InvalidParquetFooterLength { footer_len: u64, file_size: u64 },
81
82 #[error("I/O error: {0}")]
84 Io(#[from] std::io::Error),
85}