use std::path::PathBuf; use thiserror::Error; #[derive(Error, Debug)] pub enum Error { #[error("invalid mod id '{0}'")] InvalidModId(String), #[error("underlying HTTP error")] UreqError(#[from] ureq::Error), #[error("underlying I/O error")] IoError(#[from] std::io::Error), #[error("the website returned unexpected data")] InvalidScrape, #[error("'{0}' is not a valid mod directory")] InvalidModDir(PathBuf), #[error("ZIP error")] ZipError(#[from] zip::result::ZipError), #[error("the downloaded file was empty")] EmptyArchive, #[error("'{0}' is not a valid game directory")] InvalidGameDir(PathBuf), #[error("'{0}' is not a valid world directory")] InvalidWorldDir(PathBuf), #[error("'{0}' is not a valid modpack directory")] InvalidModpackDir(PathBuf), #[error("the world has no game ID set")] NoGameSet, #[error("'{0}' does not represent a valid mod source")] InvalidSourceSpec(String), #[error("invalid URL")] UrlError(#[from] url::ParseError), #[error("the mod ID '{0}' does not point to a single mod")] AmbiguousModId(String), #[cfg(unix)] #[error("underlying Unix error")] NixError(#[from] nix::errno::Errno), } pub type Result = std::result::Result;