use std::io;
use thiserror::Error;
use crate::pack::PackError;
#[derive(Error, Debug)]
pub enum CasError {
#[error("blob not found: {0}")]
BlobNotFound(String),
#[error("hash mismatch: expected {expected}, got {actual}")]
HashMismatch {
expected: String,
actual: String,
},
#[error("lock poisoned: {0}")]
LockPoisoned(String),
#[error("I/O error: {0}")]
Io(#[from] io::Error),
#[error("compression error: {0}")]
CompressionError(String),
#[error("decompression error: {0}")]
DecompressionError(String),
#[error("decompressed data too large: {max} bytes max")]
DecompressionTooLarge {
max: usize,
},
#[error("blob already exists: {0}")]
AlreadyExists(String),
#[error("invalid path: {0}")]
InvalidPath(String),
#[error("pack error: {0}")]
Pack(#[from] PackError),
#[error("gc path outside store root: {0}")]
GcPathEscape(String),
#[error("background gc task failed: {0}")]
TaskJoin(String),
}