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