neo_solidity/solidity/
solidity_errors.rs1#[derive(Debug, Error)]
3pub enum SolidityError {
4 #[error("{0}")]
5 Frontend(#[from] crate::frontend::FrontendError),
6
7 #[error("{0}")]
8 Analysis(String),
9
10 #[error("no contract definitions found in source")]
11 NoContracts,
12
13 #[error("contract '{0}' not found")]
14 ContractNotFound(String),
15
16 #[error("unsupported feature: {0}")]
17 UnsupportedFeature(String),
18
19 #[error("inheritance error: {0}")]
20 InheritanceError(String),
21}
22
23impl SolidityError {
24 pub fn analysis(msg: impl Into<String>) -> Self {
26 Self::Analysis(msg.into())
27 }
28
29 pub fn unsupported(feature: impl Into<String>) -> Self {
31 Self::UnsupportedFeature(feature.into())
32 }
33
34 pub fn is_recoverable(&self) -> bool {
36 matches!(self, Self::UnsupportedFeature(_))
37 }
38}