Skip to main content

nado_sdk/utils/
client_error.rs

1use eyre::{eyre, Report};
2use thiserror::Error;
3
4#[derive(Error, Debug, Clone)]
5pub enum ClientError {
6    #[error("Access from your IP is blocked. Please check your location and try again.")]
7    IPBlocked(String),
8
9    #[error("Subaccount name byte size, {0}, must be less than 12 bytes")]
10    SubaccountNameSize(usize),
11
12    #[error("Product id {0} is out of bounds")]
13    ProductIdOutOfBounds(u32),
14
15    #[error("Subaccount does not match wallet address")]
16    SubaccountWalletMismatch,
17
18    #[error("Feature not implemented for engine testing environment")]
19    NotImplementedEngineTest,
20
21    #[error("Admin request failed {0}")]
22    AdminFailed(String),
23
24    #[error("Balance not found for product_id: {0}")]
25    BalanceNotFound(u32),
26
27    #[error("Internal error: {0:?}")]
28    InternalError(String),
29}
30
31pub fn none_error(name: &str) -> Report {
32    eyre!("{} is None!", name)
33}