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
use thiserror::Error;
pub type Result<T> = std::result::Result<T, SolcError>;
#[derive(Debug, Error)]
pub enum SolcError {
#[error("Solc Error: {0}")]
SolcError(String),
#[error("missing pragma from solidity file")]
PragmaNotFound,
#[error("could not find solc version locally or upstream")]
VersionNotFound,
#[error("checksum mismatch")]
ChecksumMismatch,
#[error(transparent)]
SemverError(#[from] semver::Error),
#[error(transparent)]
SerdeJson(#[from] serde_json::Error),
#[error(transparent)]
Io(#[from] std::io::Error),
#[cfg(feature = "svm")]
#[error(transparent)]
SvmError(#[from] svm::SolcVmError),
#[error("no contracts found under {0}")]
NoContracts(String),
#[error(transparent)]
PatternError(#[from] glob::PatternError),
}
impl SolcError {
pub(crate) fn solc(msg: impl Into<String>) -> Self {
SolcError::SolcError(msg.into())
}
}