bybit_rust_api/rest/errors/
mod.rs1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum BybitError {
5 #[error("HTTP error: {0}")]
6 Http(#[from] reqwest::Error),
7
8 #[error("JSON error: {0}")]
9 Json(#[from] serde_json::Error),
10
11 #[error("Serialization error: {0}")]
12 UrlEncoded(#[from] serde_urlencoded::ser::Error),
13
14 #[error("API error: {0}")]
15 Api(ErrorCodes),
16
17 #[error("Configuration error: {0}")]
18 Config(String),
19
20 #[error("Internal error: {0}")]
21 Internal(String),
22
23 #[error(transparent)]
24 Other(#[from] anyhow::Error),
25}
26
27pub type BybitResult<T> = std::result::Result<T, BybitError>;
28
29include!(concat!(env!("OUT_DIR"), "/error_codes.rs"));