Skip to main content

ps_compress/
error.rs

1use ps_buffer::BufferError;
2use thiserror::Error;
3
4#[derive(Error, Debug, Clone, PartialEq, Eq)]
5pub enum CompressionError {
6    #[error(transparent)]
7    BufferError(#[from] BufferError),
8    #[error("Insufficient buffer size, output too large")]
9    InsufficientSpace,
10    #[error("Compression error")]
11    CodecError,
12}
13
14#[derive(Error, Debug, Clone, PartialEq, Eq)]
15pub enum DecompressionError {
16    #[error(transparent)]
17    BufferError(#[from] BufferError),
18    #[error("Decompression error: invalid data")]
19    BadData,
20    #[error("Decompressed size {size} exceeds maximum {max}")]
21    TooLarge { size: usize, max: usize },
22    #[error("Insufficient buffer size, output too large")]
23    InsufficientSpace,
24}