#[derive(thiserror::Error, Debug)]
#[non_exhaustive]
pub enum Error {
#[error("Command Error: {0}")]
Command(String),
#[error("Path Error: {0}")]
Path(String),
#[error("Path Error: {0}")]
PathPrefix(#[from] std::path::StripPrefixError),
#[error("Dialog Error: {0}")]
Dialog(String),
#[error("user cancelled the dialog")]
DialogCancelled,
#[cfg(feature = "http-api")]
#[error("Network Error: {0}")]
Network(#[from] reqwest::Error),
#[error(transparent)]
HttpMethod(#[from] http::method::InvalidMethod),
#[error(transparent)]
HttpHeaderValue(#[from] http::header::InvalidHeaderValue),
#[error(transparent)]
HttpHeader(#[from] http::header::InvalidHeaderName),
#[error(transparent)]
Utf8(#[from] std::string::FromUtf8Error),
#[error("http form must be an object")]
InvalidHttpForm,
#[error(transparent)]
Semver(#[from] semver::Error),
#[error(transparent)]
Json(#[from] serde_json::Error),
#[error(transparent)]
Io(#[from] std::io::Error),
#[error("{0}, path {1}")]
PathIo(std::io::Error, std::path::PathBuf),
#[error("failed to walkdir: {0}")]
Ignore(#[from] ignore::Error),
#[cfg(feature = "fs-extract-api")]
#[error(transparent)]
Zip(#[from] zip::result::ZipError),
#[cfg(feature = "fs-extract-api")]
#[error("Failed to extract: {0}")]
Extract(String),
#[cfg(notification_all)]
#[error(transparent)]
Notification(#[from] notify_rust::error::Error),
#[error(transparent)]
Url(#[from] url::ParseError),
#[error("failed to detect platform: {0}")]
FailedToDetectPlatform(String),
#[cfg(feature = "cli")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "cli")))]
#[error("failed to parse CLI arguments: {0}")]
ParseCliArguments(String),
#[error("shell error: {0}")]
Shell(String),
#[error("unknown program name: {0}")]
UnknownProgramName(String),
#[error(transparent)]
Http(#[from] http::Error),
}
#[cfg(feature = "cli")]
impl From<clap::Error> for Error {
fn from(error: clap::Error) -> Self {
Self::ParseCliArguments(error.to_string())
}
}