use thiserror::Error;
#[derive(Debug, Error, PartialEq, Eq)]
#[non_exhaustive]
pub enum RefsError {
#[error("buffer too small for {structure}: need {need} bytes, have {have}")]
Truncated {
structure: &'static str,
need: usize,
have: usize,
},
#[error("bad ReFS signature at offset 3: found {found:02x?}, expected \"ReFS\\0\\0\\0\\0\"")]
BadSignature {
found: [u8; 8],
},
#[error("bad FSRS identifier at offset 16: found {found:02x?} (\"{found_ascii}\"), expected \"FSRS\"")]
BadFsrs {
found: [u8; 4],
found_ascii: String,
},
#[error("bad metadata-block signature at offset {offset:#x}: found {found:02x?} (\"{found_ascii}\"), expected \"{expected}\"")]
BadBlockSignature {
found: [u8; 4],
found_ascii: String,
expected: &'static str,
offset: u64,
},
#[error("object id {object_id:#x} not found in the object table")]
ObjectIdNotFound {
object_id: u64,
},
#[error(
"object tree-root block {block} is a virtual address outside the resident region \
(needs container-table translation — not yet implemented)"
)]
UnresolvedVirtualBlock {
block: u64,
},
#[error("unsupported ReFS format version {major}.{minor}: this reader supports v3.x only (major == 3)")]
UnsupportedVersion {
major: u8,
minor: u8,
},
}