hopr_chain_types/
errors.rs

1#[cfg(feature = "use-bindings")]
2use hopr_bindings::exports::alloy::{contract::Error as ContractError, signers::Error as SignerError};
3
4/// Dynamic contract result type.
5pub type Result<T, E = ChainTypesError> = core::result::Result<T, E>;
6
7/// Error when working with chain types.
8#[derive(thiserror::Error, Debug)]
9pub enum ChainTypesError {
10    #[error("invalid state: {0}")]
11    InvalidState(&'static str),
12
13    #[error("invalid arguments: {0}")]
14    InvalidArguments(&'static str),
15
16    #[error("signing error: {0}")]
17    SigningError(#[source] anyhow::Error),
18
19    /// An error occurred while signing a hash.
20    #[cfg(feature = "use-bindings")]
21    #[error(transparent)]
22    SignerError(#[from] SignerError),
23
24    /// An error occurred while interacting with contracts.
25    #[cfg(feature = "use-bindings")]
26    #[error(transparent)]
27    ContractError(#[from] ContractError),
28
29    /// An error occurred while parsing an EIP-2718 transaction.
30    #[error("error while parsing an EIP-2718 transaction: {0}")]
31    ParseError(#[source] anyhow::Error),
32}