use std::io;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("io: {0}")]
Io(#[from] io::Error),
#[error("out of bounds: offset {offset} len {len} exceeds device size {size}")]
OutOfBounds { offset: u64, len: u64, size: u64 },
#[error("invalid image: {0}")]
InvalidImage(String),
#[error("unsupported feature: {0}")]
Unsupported(String),
#[error("invalid argument: {0}")]
InvalidArgument(String),
#[error("{op}: {kind} is a streaming format — use `fstool repack` to produce a new one")]
Streaming {
kind: &'static str,
op: &'static str,
},
#[error("{op}: {kind} is a write-once format — use `fstool repack` to rebuild it")]
Immutable {
kind: &'static str,
op: &'static str,
},
}
pub type Result<T> = std::result::Result<T, Error>;