use std::{io, path::PathBuf};
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("file hash {actual} does not match expected hash {expected}")]
HashMismatch {
expected: String,
actual: String,
},
#[error("failed to read hash file: {path}")]
HashRead {
path: PathBuf,
#[source]
source: io::Error,
},
#[error("failed to write hash file: {path}")]
HashWrite {
path: PathBuf,
#[source]
source: io::Error,
},
#[error("remote request failed")]
Request(#[source] Box<ureq::Error>),
#[error("download failed")]
Download(#[source] io::Error),
#[error("tarball decompression failed")]
Decompress(#[source] lzma_rs::error::Error),
#[error("failed to remove cache directory: {path}")]
RemoveDir {
path: PathBuf,
#[source]
source: io::Error,
},
#[error("failed to read archive entries")]
ArchiveEntries(#[source] io::Error),
#[error("failed to read archive entry")]
ArchiveEntry(#[source] io::Error),
#[error("failed to resolve archive entry path")]
ArchiveEntryPath(#[source] io::Error),
#[error("failed to create directory: {path}")]
CreateDir {
path: PathBuf,
#[source]
source: io::Error,
},
#[error("failed to unpack archive entry to: {path}")]
Unpack {
path: PathBuf,
#[source]
source: io::Error,
},
}