1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
use thiserror::Error; pub type Result<T> = std::result::Result<T, Error>; #[derive(Debug, Error)] pub enum Error { #[error( "Unable to find {binary} to execute. Run `monger get {version}` and try again if you're \ sure the version and binary name are correct" )] BinaryNotFound { binary: String, version: String }, #[error("`{command}` command failed")] FailedSubprocess { command: String, exit_code: Option<i32>, }, #[error("An HTTP error occurred: {inner}")] Http { #[from] inner: reqwest::Error, }, #[error("HTML response from {url} did not match expected structure")] InvalidHtml { url: String }, #[error("MongoDB version {version} does not exist")] InvalidVersion { version: String }, #[error("An I/O error occurred: {inner}")] Io { #[from] inner: std::io::Error, }, #[error("Unable to determine the OS release version")] OsRelease { #[from] inner: rs_release::OsReleaseError, }, #[error("Unable to parse semantic version")] SemVer { #[from] inner: semver::SemVerError, }, #[error("Unable to convert HTTP header to string: {inner}")] ToStr { #[from] inner: reqwest::header::ToStrError, }, #[error("Unable to find home directory")] UnknownHomeDirectory, #[error("Unable to identify operating system")] UnknownOs, #[error("{os_name} is unsupported")] UnsupportedOs { os_name: String }, #[error("Unable to find version {version}")] VersionNotFound { version: String }, }