#[derive(thiserror::Error, Debug)]
pub enum DownloadError {
#[error("Creating the reqwest client failed: {0}")]
ClientCreationFailed(String),
#[error("Opening the request failed: {0}")]
OpenFailed(Box<dyn std::error::Error + Send + Sync>),
#[error("The download timed out")]
Timeout,
#[error("The server returned status code {0}")]
StatusError(u16),
#[error("The destination directory could not be created")]
CouldNotCreateDestinationDirectory,
#[error("The response used an unexpected Content-Encoding: {0}")]
UnexpectedContentEncoding(String),
#[error("Error when reading the download stream: {0}")]
StreamRead(std::io::Error),
#[error("Error while writing the downloaded file to disk: {0}")]
DiskWrite(std::io::Error),
#[error("Redirect-related error")]
Redirect(Box<dyn std::error::Error + Send + Sync>),
#[error("Other error: {0}")]
Other(Box<dyn std::error::Error + Send + Sync>),
}