paystack/
errors.rs

1//! Error
2//! ========
3//! This file contains the structs and definitions of the errors in this crate.
4use thiserror::Error;
5
6/// Custom Error for the Paystack API
7#[derive(Error, Debug)]
8#[non_exhaustive]
9pub enum PaystackAPIError {
10    /// Generic error, not used frequently
11    #[error("Generic error: {0}")]
12    Generic(String),
13    /// Error associated with Transaction operation
14    #[error("Transaction Error: {0}")]
15    Transaction(String),
16    /// Error associated with Charge
17    #[error("Charge Error: {0}")]
18    Charge(String),
19    /// Error associated with Transaction Split
20    #[error("Transaction Split Error: {0}")]
21    TransactionSplit(String),
22    /// Error associated with Subaccount
23    #[error("Subaccount Error: {0}")]
24    Subaccount(String),
25    /// Error associated with terminal
26    #[error("Terminal Error: {0}")]
27    Terminal(String),
28    /// Error associated with virtual terminal
29    #[error("Virtual Terminal Error: {0}")]
30    VirtualTerminal(String),
31    /// Error associated with customer
32    #[error("Customer Error: {0}")]
33    Customer(String),
34    #[error("Dedicated Virtual Account Error: {0}")]
35    DedicatedVirtualAccount(String),
36    #[error("Apple Pay Error: {0}")]
37    ApplePay(String),
38}