neo_solidity/frontend/
frontend_errors.rs1#[derive(Debug, Error)]
3pub enum FrontendError {
4 #[error("Solidity parsing failed:\n{0}")]
6 Parse(String),
7
8 #[error("Unsupported Solidity version: {0}")]
10 UnsupportedVersion(String),
11
12 #[error("Failed to resolve import '{path}': {reason}")]
14 ImportError { path: String, reason: String },
15
16 #[error("Contract '{0}' not found in source")]
18 ContractNotFound(String),
19}
20
21impl FrontendError {
22 pub fn parse_at(line: usize, column: usize, message: impl Into<String>) -> Self {
24 Self::Parse(format!("{}:{}: {}", line, column, message.into()))
25 }
26
27 pub fn import_error(path: impl Into<String>, reason: impl Into<String>) -> Self {
29 Self::ImportError {
30 path: path.into(),
31 reason: reason.into(),
32 }
33 }
34
35 pub fn is_recoverable(&self) -> bool {
37 matches!(self, Self::UnsupportedVersion(_))
38 }
39}
40