use core::fmt::Debug;
#[derive(Debug, thiserror::Error)]
pub enum Error<R: Debug, F: Debug> {
#[error("Remote Error: {0}")]
Remote(R),
#[error("Filesystem Error: {0}")]
FileSystem(F),
#[error("Internal Error while Joining Background tasks")]
JoinError,
#[error("Remote Zip invalid, no EOCD found")]
NoEocdFound,
#[error("Remote Zip invalid, invalid CentralDirectoryHeader signature")]
InvalidCentralDirectoryHeaderSignature,
#[error("Remote Zip invalid, no CentralDirectoryHeaders found")]
NoCentralDirectoryHeaderFound,
#[error("Remote Zip invalid, CentralDirectoryHeader has invalid file name")]
InvalidFileName,
#[error("Remote Zip invalid, Invalid local header signature while trying to read: {file_name}")]
InvalidLocalHeaderSignature { file_name: String },
#[error(
"The calculated byte range to download a batch is to short. was downloading file: {file_name}. storage \
contains {storage_size} bytes, but {expected_compressed_size} are necessary"
)]
InsufficientDownloadRange {
file_name: String,
storage_size: u64,
expected_compressed_size: u64,
},
#[error("Overlapping Filesizes From Download detected")]
OverlappingBytesForDifferentFiles,
#[error("Invalid UTF8-Filename. this code requires filenames to match UTF8")]
InvalidUtf8Filename,
#[error(
"The bytes length: {bytes_cnt} passed to unzip doesn't match the file '{file_name}' size: \
{expected_compressed_size}"
)]
WrongBytesLength {
file_name: String,
bytes_cnt: u64,
expected_compressed_size: u64,
},
#[error("Unsupported compression method found")]
UnsupportedCompressionMethod,
#[error("the compression method returned an error decompressing the file")]
CompressionError,
#[error("The remote file hash doesn't match its calculated one")]
InvalidHash,
#[error("zip-core parse error: {0}")]
ParseError(#[from] zip_core::raw::parse::DynamicSizeError),
}