crabka_compression/
error.rs1use thiserror::Error;
4
5#[derive(Debug, Error)]
7#[non_exhaustive]
8pub enum CompressionError {
9 #[error("compression feature `{0}` not enabled at compile time")]
12 FeatureDisabled(&'static str),
13
14 #[error("invalid compressed data: {0}")]
17 InvalidData(String),
18
19 #[error("I/O error: {0}")]
21 Io(#[from] std::io::Error),
22}
23
24#[cfg(test)]
25mod tests {
26 use super::*;
27 use assert2::assert;
28
29 #[test]
30 fn feature_disabled_display() {
31 let e = CompressionError::FeatureDisabled("snappy");
32 assert!(e.to_string() == "compression feature `snappy` not enabled at compile time");
33 }
34}