1use stellar_baselib::xdr::SorobanTransactionData;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
8pub enum AuthModeError {
9 #[error("Invalid auth mode: {0}, should be one of 'enforce', 'record', 'record_allow_nonroot' or be omitted")]
11 Invalid(String),
12}
13
14#[derive(Error, Debug)]
16pub enum Error {
17 #[error(transparent)]
19 InvalidRpc(#[from] InvalidRpcUrl),
20 #[error("XdrError")]
22 XdrError,
23 #[error("JsonError: could not parse {0}")]
25 JsonError(String),
26 #[error("NetworkError")]
28 NetworkError(#[from] reqwest::Error),
29 #[error("AccountError")]
31 AccountNotFound,
32 #[error("ContractError")]
34 ContractDataNotFound,
35 #[error("TransactionError")]
37 TransactionError,
38 #[error("InvalidSorobanTransaction")]
40 InvalidSorobanTransaction,
41 #[error("SimulationFailed: `{0}`")]
43 SimulationFailed(String),
44 #[error("RestorationRequired")]
46 RestorationRequired(i64, SorobanTransactionData),
47 #[error("RPCError {code}: {message}")]
49 RPCError {
50 code: i32,
52 message: String,
54 },
55 #[error("UnexpectedError")]
57 UnexpectedError,
58 #[error("NoFriendbot")]
60 NoFriendbot,
61 #[error("Timeout of {0}s reached after {1}s while waiting for a transaction to complete")]
63 WaitTransactionTimeout(u64, u64),
64 #[error("NotImplemented: `{0}`")]
66 NotImplemented(String),
67}
68
69#[derive(Error, Debug)]
71pub enum InvalidRpcUrl {
72 #[error("The RPC Url scheme should be http or https")]
74 NotHttpScheme,
75 #[error("Http scheme requires the option allow_http: true")]
77 UnsecureHttpNotAllowed,
78 #[error("InvalidUrl")]
80 InvalidUri,
81}