Skip to main content

xrpl/core/addresscodec/
exceptions.rs

1//! General XRPL Address Codec Exception.
2
3use thiserror_no_std::Error;
4
5#[derive(Debug, Clone, PartialEq, Error)]
6#[non_exhaustive]
7pub enum XRPLAddressCodecException {
8    #[error("Invalid XAddress prefix")]
9    InvalidXAddressPrefix,
10    #[error("Invalid XAddress zero tag")]
11    InvalidXAddressZeroNoTag,
12    #[error("Invalid XAddress zero remain")]
13    InvalidXAddressZeroRemain,
14    #[error("Invalid classic address length (length: {length})")]
15    InvalidCAddressIdLength { length: usize },
16    #[error("Invalid classic address tag")]
17    InvalidCAddressTag,
18    #[error("Invalid seed prefix encoding type")]
19    InvalidSeedPrefixEncodingType,
20    #[error("Invalid encoding prefix length")]
21    InvalidEncodingPrefixLength,
22    #[error("Invalid classic address value")]
23    InvalidClassicAddressValue,
24    #[error("Unsupported XAddress")]
25    UnsupportedXAddress,
26    #[error("Unknown seed encoding")]
27    UnknownSeedEncoding,
28    #[error("Unknown payload lenght (expected: {expected}, found: {found})")]
29    UnexpectedPayloadLength { expected: usize, found: usize },
30    #[error("Base58 decode error: {0}")]
31    Base58DecodeError(#[from] bs58::decode::Error),
32    #[error("Vec resize error")]
33    VecResizeError(#[from] alloc::vec::Vec<u8>),
34}
35
36#[cfg(feature = "std")]
37impl alloc::error::Error for XRPLAddressCodecException {}