everscale_types/abi/
error.rs1use std::sync::Arc;
4
5#[derive(Debug, Clone, thiserror::Error)]
7pub enum ParseAbiVersionError {
8 #[error("invalid format")]
10 InvalidFormat,
11 #[error("invalid component")]
13 InvalidComponent(#[source] std::num::ParseIntError),
14}
15
16#[derive(Debug, Clone, thiserror::Error)]
18pub enum ParseAbiTypeError {
19 #[error("invalid array type")]
21 InvalidArrayType,
22 #[error("invalid array length")]
24 InvalidArrayLength(#[source] std::num::ParseIntError),
25 #[error("invalid integer bit length")]
27 InvalidBitLen(#[source] std::num::ParseIntError),
28 #[error("invalid byte length")]
30 InvalidByteLen(#[source] std::num::ParseIntError),
31 #[error("unterminated inner type")]
33 UnterminatedInnerType,
34 #[error("map value type not found")]
36 ValueTypeNotFound,
37 #[error("unknown type")]
39 UnknownType,
40}
41
42#[derive(Debug, Clone, thiserror::Error)]
44pub enum ParseNamedAbiTypeError {
45 #[error("invalid type `{ty}`: {error}")]
47 InvalidType {
48 ty: Box<str>,
50 #[source]
52 error: ParseAbiTypeError,
53 },
54 #[error("unexpected components for `{ty}`")]
56 UnexpectedComponents {
57 ty: Box<str>,
59 },
60 #[error("expected components for `{ty}`")]
62 ExpectedComponents {
63 ty: Box<str>,
65 },
66}
67
68#[derive(Debug, Clone, Eq, PartialEq, thiserror::Error)]
70pub enum AbiError {
71 #[error("expected ABI type `{expected}`, got `{ty}`")]
73 TypeMismatch {
74 expected: Box<str>,
76 ty: Box<str>,
78 },
79 #[error("unexpected init data parameter `{0}`")]
81 UnexpectedInitDataParam(Arc<str>),
82 #[error("missing init data field `{0}`")]
84 InitDataFieldNotFound(Arc<str>),
85 #[error("slice was not fully consumed during parsing")]
87 IncompleteDeserialization,
88 #[error("number of bits in a cell is not a multiple of 8")]
90 ExpectedCellWithBytes,
91 #[error("invalid string")]
93 InvalidString(#[from] std::str::Utf8Error),
94 #[error("expected array of len {expected}, got {len}")]
96 ArraySizeMismatch {
97 expected: usize,
99 len: usize,
101 },
102 #[error("expected bytes of len {expected}, got {len}")]
104 BytesSizeMismatch {
105 expected: usize,
107 len: usize,
109 },
110 #[error("an address was expected for signing but was not provided")]
112 AddressNotProvided,
113 #[error("expected input id 0x{expected:08x}, got 0x{id:08x}")]
115 InputIdMismatch {
116 expected: u32,
118 id: u32,
120 },
121 #[error("expected output id 0x{expected:08x}, got 0x{id:08x}")]
123 OutputIdMismatch {
124 expected: u32,
126 id: u32,
128 },
129}