use std::sync::Arc;
#[derive(Debug, Clone, thiserror::Error)]
pub enum ParseAbiVersionError {
#[error("invalid format")]
InvalidFormat,
#[error("invalid component")]
InvalidComponent(#[source] std::num::ParseIntError),
}
#[derive(Debug, Clone, thiserror::Error)]
pub enum ParseAbiTypeError {
#[error("invalid array type")]
InvalidArrayType,
#[error("invalid array length")]
InvalidArrayLength(#[source] std::num::ParseIntError),
#[error("invalid integer bit length")]
InvalidBitLen(#[source] std::num::ParseIntError),
#[error("invalid byte length")]
InvalidByteLen(#[source] std::num::ParseIntError),
#[error("unterminated inner type")]
UnterminatedInnerType,
#[error("map value type not found")]
ValueTypeNotFound,
#[error("unknown type")]
UnknownType,
}
#[derive(Debug, Clone, thiserror::Error)]
pub enum ParseNamedAbiTypeError {
#[error("invalid type `{ty}`: {error}")]
InvalidType {
ty: Box<str>,
#[source]
error: ParseAbiTypeError,
},
#[error("unexpected components for `{ty}`")]
UnexpectedComponents {
ty: Box<str>,
},
#[error("expected components for `{ty}`")]
ExpectedComponents {
ty: Box<str>,
},
}
#[derive(Debug, Clone, Eq, PartialEq, thiserror::Error)]
pub enum AbiError {
#[error("expected ABI type `{expected}`, got `{ty}`")]
TypeMismatch {
expected: Box<str>,
ty: Box<str>,
},
#[error("unexpected init data parameter `{0}`")]
UnexpectedInitDataParam(Arc<str>),
#[error("missing init data field `{0}`")]
InitDataFieldNotFound(Arc<str>),
#[error("slice was not fully consumed during parsing")]
IncompleteDeserialization,
#[error("number of bits in a cell is not a multiple of 8")]
ExpectedCellWithBytes,
#[error("invalid string")]
InvalidString(#[from] std::str::Utf8Error),
#[error("expected array of len {expected}, got {len}")]
ArraySizeMismatch {
expected: usize,
len: usize,
},
#[error("expected bytes of len {expected}, got {len}")]
BytesSizeMismatch {
expected: usize,
len: usize,
},
#[error("an address was expected for signing but was not provided")]
AddressNotProvided,
#[error("expected input id 0x{expected:08x}, got 0x{id:08x}")]
InputIdMismatch {
expected: u32,
id: u32,
},
#[error("expected output id 0x{expected:08x}, got 0x{id:08x}")]
OutputIdMismatch {
expected: u32,
id: u32,
},
#[error("explicit pubkey was not used")]
PubkeyNotUsed,
}