1use reqwest::StatusCode;
2use thiserror::Error;
3use url::Url;
4
5#[derive(Debug, Error)]
7pub enum SvmError {
8 #[error("SVM global version not set")]
9 GlobalVersionNotSet,
10 #[error("Unknown version provided")]
11 UnknownVersion,
12 #[error("Unsupported version {0} for platform {1}")]
13 UnsupportedVersion(String, String),
14 #[error("Version {0} not installed")]
15 VersionNotInstalled(String),
16 #[error("Checksum mismatch for version {version}: expected: {expected}, actual: {actual}")]
17 ChecksumMismatch {
18 version: String,
19 expected: String,
20 actual: String,
21 },
22 #[error("Install step for solc version {0} timed out after {1} seconds")]
23 Timeout(String, u64),
24 #[error("Unable to patch solc binary for nixos. stdout: {0}. stderr: {1}")]
25 CouldNotPatchForNixOs(String, String),
26 #[error(transparent)]
27 IoError(#[from] std::io::Error),
28 #[error(transparent)]
29 PersistError(#[from] tempfile::PathPersistError),
30 #[error(transparent)]
31 ReqwestError(#[from] reqwest::Error),
32 #[error(transparent)]
33 SemverError(#[from] semver::Error),
34 #[error(transparent)]
35 UrlError(#[from] url::ParseError),
36 #[error("Received unsuccessful response with code {1} for {0}")]
37 UnsuccessfulResponse(Url, StatusCode),
38 #[cfg(all(target_os = "windows", target_arch = "x86_64"))]
39 #[error(transparent)]
40 ZipError(#[from] zip::result::ZipError),
41}