selene_helius_sdk/
error.rs

1use reqwest::StatusCode;
2use thiserror::Error;
3use url::ParseError;
4
5#[derive(Debug, Error)]
6pub enum HeliusError {
7  #[error("Deserialization Error: {err}. Response: {text}")]
8  /// Serde JSON Error
9  SerdeJson { err: serde_json::Error, text: String },
10
11  #[error(transparent)]
12  /// Thrown when submitting a POST/GET request fails
13  ReqwestError(#[from] reqwest::Error),
14
15  #[error(transparent)]
16  UrlError(#[from] ParseError),
17
18  #[error("Internal Error. HTTP Code {code} {text}")]
19  InternalError { code: StatusCode, text: String },
20
21  #[error("{path} not found. ")]
22  NotFound { path: String },
23
24  #[error("Bad Request for {path} {text} ")]
25  BadRequest { path: String, text: String },
26
27  #[error("Unauthorized for {path} {text} ")]
28  Unauthorized { path: String, text: String },
29
30  #[error("Unknown Error HTTP Code: {code} {text}")]
31  Unknown { code: StatusCode, text: String },
32
33  #[error("RPC Error  code:{code} message:{message}")]
34  RpcError { code: i32, message: String },
35
36  #[error("Invalid cluster:{message}")]
37  InvalidCluster { message: String },
38
39  #[error(transparent)]
40  SolanaClientError(#[from] solana_client::client_error::ClientError),
41
42  #[error("Too Many Requests: {path}")]
43  TooManyRequests { path: String },
44
45  #[error("Invalid fee response type {response}")]
46  InvalidFeeResponse { response: String },
47
48  #[error(transparent)]
49  TransactionEncodeError(#[from] bincode::Error),
50}