use thiserror::Error;
#[derive(Error, Debug)]
pub enum DeltaError {
#[error("Chunking error: {0}")]
Chunking(String),
#[error("Copy operation out of bounds: offset={offset} len={len} basis_size={basis_size}")]
InvalidCopyBounds {
offset: u64,
len: u32,
basis_size: u64,
},
#[error("Checksum mismatch: expected {expected:?}, got {actual:?}")]
ChecksumMismatch {
expected: [u8; 32],
actual: [u8; 32],
},
#[error("Patch error: {0}")]
Patch(String),
#[error("Delta literal payload exceeds the {limit} byte budget (the basis matched nothing useful)")]
LiteralBudgetExceeded {
limit: u64,
},
}
pub type DeltaResult<T> = std::result::Result<T, DeltaError>;