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
39
40
41
42
43
44
45
46
47
48
49
50
use crate::abi::{human_readable, InvalidOutputType};
use thiserror::Error;
pub type Result<T, E = ParseError> = std::result::Result<T, E>;
#[derive(Error, Debug)]
pub enum ParseError {
#[error("{0}")]
Message(String),
#[error(transparent)]
ParseError(#[from] ethabi::Error),
#[error(transparent)]
LexerError(#[from] human_readable::lexer::LexerError),
}
macro_rules! _format_err {
($($tt:tt)*) => {
$crate::abi::ParseError::Message(format!($($tt)*))
};
}
pub(crate) use _format_err as format_err;
macro_rules! _bail {
($($tt:tt)*) => { return Err($crate::abi::error::format_err!($($tt)*)) };
}
use crate::types::ParseBytesError;
pub(crate) use _bail as bail;
#[derive(Error, Debug)]
pub enum AbiError {
#[error(transparent)]
DecodingError(#[from] ethabi::Error),
#[error(transparent)]
DetokenizationError(#[from] InvalidOutputType),
#[error("missing or wrong function selector")]
WrongSelector,
#[error(transparent)]
ParseBytesError(#[from] ParseBytesError),
}