use thiserror::Error;
use crate::client::DownloadOutput;
#[derive(Error, Debug)]
pub enum ClientDownloaderError {
#[error("An unexpected error has ocurred.")]
UnknownError,
#[error("No such version")]
NoSuchVersion,
#[error("No such directory")]
NoSuchDirectory,
#[error("{0}")]
Request(#[from] reqwest::Error),
#[error("{0}")]
IO(#[from] std::io::Error),
#[error("{0}")]
Json(#[from] serde_json::Error),
#[error("{0}")]
Download(#[from] DownloadError),
}
#[derive(Error, Debug)]
pub enum ManifestError {
#[error("The game directory doesn't exist.")]
GameDirNotExist,
#[error("The java bin doesn't exist.")]
JavaBinNotExist,
#[error("An unexpected error has ocurred.")]
UnknownError,
#[error("{0}")]
IO(#[from] std::io::Error),
#[error("{0}")]
Json(#[from] serde_json::Error),
}
#[derive(Error, Debug)]
pub enum DownloadError {
#[error("Setup error: {0}")]
Setup(String),
#[error("Download definition: {0}")]
DownloadDefinition(String),
#[error("File creation failed: {0}")]
File(DownloadOutput),
#[error("Download failed for {0}")]
Download(DownloadOutput),
#[error("Verification failed for {0}")]
Verification(DownloadOutput),
}