rtm_core/processor/
errors.rs

1use crate::models::{ClientId, TransactionId};
2
3/// Represents possible errors during transaction processing.
4#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
5#[must_use]
6pub enum TransactionError {
7    /// Current account is locked.
8    AccountLocked { client_id: ClientId },
9
10    /// Tried to apply Withdrawl with amount greater than available balance.
11    InsufficientFunds { cause_id: TransactionId },
12
13    /// Dispute, Resolve or Chargeback transaction refers to a non-existent transaction.
14    TransactionDoesNotExist { ref_id: TransactionId },
15
16    /// Tried to apply a transaction with id that was already prcoessed.
17    DuplicateTransaction { cause_id: TransactionId },
18
19    /// Tried to Dispute the same transaction twice.
20    TransactionAlreadyDisputed { ref_id: TransactionId },
21
22    /// Tried to Resolve or Chargeback a non-disputed transaction.
23    TransactionNotDisputed { ref_id: TransactionId },
24
25    /// Tried to apply a transaction to a different client.
26    CrossClientTransaction,
27}