web3_address/
error.rs

1//! Errors generated by the address library.
2use thiserror::Error;
3
4/// Error thrown by the address library.
5#[derive(Debug, Error)]
6pub enum Error {
7    /// Error generated when an address has the wrong prefix.
8    #[error("address must begin with 0x")]
9    BadAddressPrefix,
10
11    /// Error generated converting to fixed length slice.
12    #[error(transparent)]
13    TryFromSlice(#[from] std::array::TryFromSliceError),
14
15    /// Error generated by the ECDSA library.
16    #[cfg(feature = "ethereum")]
17    #[error(transparent)]
18    Ecdsa(#[from] k256::ecdsa::Error),
19
20    /// Error generated by elliptic curve library.
21    #[cfg(feature = "ethereum")]
22    #[error(transparent)]
23    Elliptic(#[from] k256::elliptic_curve::Error),
24
25    /// Error generated parsing from hex.
26    #[cfg(feature = "ethereum")]
27    #[error(transparent)]
28    Hex(#[from] hex::FromHexError),
29}