pub type DownloadResult<T> = Result<T, DownloadError>;
#[derive(Debug, thiserror::Error)]
pub enum DownloadError {
#[error("{0}")]
Request(reqwest::Error),
#[error("The request response could not provide a content-length")]
NoContentLength,
#[error("{0}")]
Io(std::io::Error),
#[error("The Checksums do not match")]
ChecksumMismatch,
}
impl From<reqwest::Error> for DownloadError {
fn from(err: reqwest::Error) -> Self {
Self::Request(err)
}
}
impl From<std::io::Error> for DownloadError {
fn from(err: std::io::Error) -> Self {
Self::Io(err)
}
}