huff_neo_test_runner/
errors.rs1use huff_neo_utils::ast::span::AstSpan;
2use huff_neo_utils::error::{CodegenError, CompilerError};
3use revm::context::result::EVMError;
4use std::convert::Infallible;
5use thiserror::Error;
6
7#[derive(Debug, Error)]
9pub enum RunnerError {
10 #[error("Runner Error: {0}")]
11 GenericError(String),
12
13 #[error("Deployment Error: {0}")]
14 DeploymentError(String),
15
16 #[error("Invalid {0}: {1}")]
17 InvalidHex(&'static str, String),
18
19 #[error("{0}")]
20 InvalidDecorator(DecoratorError),
21
22 #[error("Compiler Error: {0}")]
23 CompilerError(CompilerError),
24
25 #[error("Evm transact error with err={0}")]
26 TransactError(String),
27
28 #[error(transparent)]
29 EVMError(#[from] EVMError<Infallible>),
30
31 #[error(transparent)]
32 EVMErrorDB(#[from] EVMError<foundry_evm::backend::DatabaseError>),
33}
34
35impl From<CodegenError> for RunnerError {
36 fn from(error: CodegenError) -> Self {
37 RunnerError::CompilerError(CompilerError::CodegenError(error))
38 }
39}
40
41#[derive(Debug, Clone, PartialEq, Eq)]
43pub enum DecoratorErrorKind {
44 UnknownFlag,
46 InvalidArguments,
48 InvalidValue,
50 Duplicate,
52 Conflict,
54}
55
56#[derive(Debug, Clone, PartialEq, Eq, Error)]
58#[error("Invalid Decorator Flag: \"{flag}\"\n{}", span.error(Some(hint)))]
59pub struct DecoratorError {
60 pub flag: String,
62 pub kind: DecoratorErrorKind,
64 pub hint: String,
66 pub span: AstSpan,
68}