use thiserror::Error;
#[derive(Debug, Error, PartialEq, Eq)]
#[non_exhaustive]
pub enum BtrfsError {
#[error("buffer too small for {structure}: need {need} bytes, have {have}")]
Truncated {
structure: &'static str,
need: usize,
have: usize,
},
#[error("bad btrfs magic: found bytes {bytes:02x?} at superblock offset 0x40, expected 5f42485266535f4d (\"_BHRfS_M\")")]
BadMagic {
bytes: [u8; 8],
},
#[error("allocation bomb: {field} claims {claimed} bytes, exceeding the {bound}-byte bound")]
AllocationBomb {
field: &'static str,
claimed: u64,
bound: u64,
},
}