stellar_base/
error.rs

1//! Error and Result definitions.
2pub type Result<T> = std::result::Result<T, Error>;
3
4#[derive(thiserror::Error, Debug)]
5pub enum Error {
6    /// Error that can occur when parsing a key.
7    #[error("invalid str key")]
8    InvalidStrKey,
9    /// Invalid version byte in key.
10    #[error("invalid str key version byte")]
11    InvalidStrKeyVersionByte,
12    /// Invalid checksum in key.
13    #[error("invalid str key checksum")]
14    InvalidStrKeyChecksum,
15    /// Invalid keypair seed.
16    #[error("invalid seed")]
17    InvalidSeed,
18    /// Invalid Asset code.
19    #[error("invalid asset code")]
20    InvalidAssetCode,
21    /// Invalid data value.
22    #[error("invalid data value")]
23    InvalidDataValue,
24    /// Invalid signature.
25    #[error("invalid signature")]
26    InvalidSignature,
27    /// Invalid signature hint.
28    #[error("invalid signature hint")]
29    InvalidSignatureHint,
30    /// Invalid memo text: too long.
31    #[error("memo text too long")]
32    InvalidMemoText,
33    /// Invalid memo hash: too long.
34    #[error("memo hash too long")]
35    InvalidMemoHash,
36    /// Invalid memo return hash: too long.
37    #[error("memo return hash too long")]
38    InvalidMemoReturn,
39    /// Error that can occur when parsing amounts from stroops.
40    #[error("invalid stroops amount")]
41    InvalidStroopsAmount,
42    /// Error that can occur when converting stroops to unsigned amount.
43    #[error("stroops amount is negative")]
44    NegativeStroops,
45    /// Error that can occur when converting an amount with more than 7 digits.
46    #[error("invalid amount scale")]
47    InvalidAmountScale,
48    /// Error parsing price.
49    #[error("parse price error")]
50    ParsePriceError,
51    /// Invalid network id: too long.
52    #[error("invalid network id")]
53    InvalidNetworkId,
54    /// Invalid public key.
55    #[error("invalid public key")]
56    InvalidPublicKey,
57    /// Invalid pre auth tx.
58    #[error("invalid pre auth tx")]
59    InvalidPreAuthTx,
60    /// Invalid hash(x).
61    #[error("invalid hash(x)")]
62    InvalidHashX,
63    /// Invalid payload.
64    #[error("invalid payload")]
65    InvalidPayload,
66    /// Invalid time bounds.
67    #[error("invalid time bounds")]
68    InvalidTimeBounds,
69    /// Invalid claimable balance id length. Length must be 32 bytes.
70    #[error("invalid claimable balance id length")]
71    InvalidClaimableBalanceIdLength,
72    /// Invalid liquidity pool id length. Length must be 32 bytes.
73    #[error("invalid liquidity pool id length")]
74    InvalidLiquidityPoolIdLength,
75    /// Error that can occur when parsing amounts.
76    #[error("error parsing amount")]
77    ParseAmountError(#[from] rust_decimal::Error),
78    /// Error that occurs when building operations.
79    #[error("error building operation")]
80    InvalidOperation(String),
81    /// Error that occurs when building a transaction with too many operations.
82    #[error("transaction has too many operations")]
83    TooManyOperations,
84    /// Error that occurs when building a transaction with no operations.
85    #[error("transaction has no operations")]
86    MissingOperations,
87    /// Transaction fee is too low.
88    #[error("transaction fee too low")]
89    TransactionFeeTooLow,
90    /// Home domain is too long.
91    #[error("home domain too long")]
92    HomeDomainTooLong,
93    /// Invalid account flags.
94    #[error("invalid account flags")]
95    InvalidAccountFlags,
96    /// Invalid trust line flags.
97    #[error("invalid trust line flags")]
98    InvalidTrustLineFlags,
99    /// Transaction fee overflow.
100    #[error("transaction fee overflow")]
101    TransactionFeeOverflow,
102    /// Xdr conversion error
103    #[error("xdr conversion error")]
104    XdrError,
105    /// Unsupported feature
106    #[error("unsupported feature")]
107    UnsupportedFeature,
108    /// Invalid xdr claim predicate
109    #[error("Invalid xdr claim predicate")]
110    XdrClaimPredicateError,
111    /// Base64 decode error
112    #[error("base64 decode error")]
113    Base64DecodeError(#[from] base64::DecodeError),
114}