#[derive(Debug, Error)]
pub enum SolidityError {
#[error("{0}")]
Frontend(#[from] crate::frontend::FrontendError),
#[error("{0}")]
Analysis(String),
#[error("no contract definitions found in source")]
NoContracts,
#[error("contract '{0}' not found")]
ContractNotFound(String),
#[error("unsupported feature: {0}")]
UnsupportedFeature(String),
#[error("inheritance error: {0}")]
InheritanceError(String),
}
impl SolidityError {
pub fn analysis(msg: impl Into<String>) -> Self {
Self::Analysis(msg.into())
}
pub fn unsupported(feature: impl Into<String>) -> Self {
Self::UnsupportedFeature(feature.into())
}
pub fn is_recoverable(&self) -> bool {
matches!(self, Self::UnsupportedFeature(_))
}
}