Skip to main content

xrpl/asynch/transaction/
exceptions.rs

1use core::num::ParseIntError;
2
3use alloc::string::String;
4use thiserror_no_std::Error;
5
6// XRPLSignTransactionException now lives in `crate::signing::exceptions`.
7// Re-exported here for backward compatibility.
8pub use crate::signing::exceptions::XRPLSignTransactionException;
9
10#[derive(Error, Debug, PartialEq)]
11#[non_exhaustive]
12pub enum XRPLTransactionHelperException {
13    #[error("Fee of {0:?} Drops is much higher than a typical XRP transaction fee. This may be a mistake. If intentional, please use `check_fee = false`")]
14    FeeUnusuallyHigh(String),
15    #[error("Unable to parse rippled version: {0}")]
16    ParseRippledVersionError(ParseIntError),
17    #[error("Invalid rippled version: {0}")]
18    InvalidRippledVersion(String),
19    #[error("XRPL Sign Transaction error: {0}")]
20    XRPLSignTransactionError(#[from] XRPLSignTransactionException),
21    #[error("XRPL Submit and Wait error: {0}")]
22    XRPLSubmitAndWaitError(#[from] XRPLSubmitAndWaitException),
23}
24
25#[derive(Debug, Clone, PartialEq, Eq, Error)]
26#[non_exhaustive]
27pub enum XRPLSubmitAndWaitException {
28    #[error("Transaction submission failed: {0}")]
29    SubmissionFailed(String),
30    #[error("The latest validated ledger sequence {validated_ledger_sequence} is greater than the LastLedgerSequence {last_ledger_sequence} in the Transaction. Prelim result: {prelim_result}")]
31    SubmissionTimeout {
32        last_ledger_sequence: u32,
33        validated_ledger_sequence: u32,
34        prelim_result: String,
35    },
36    #[error("Expected field in the transaction metadata: {0}")]
37    ExpectedFieldInTxMeta(String),
38}