bybit_rust_api/handlers/
api_error.rs

1use fmt::{Display, Formatter};
2use serde::{Deserialize, Serialize};
3use std::error::Error;
4use std::fmt;
5
6#[derive(Debug, Serialize, Deserialize)]
7pub struct APIError {
8    #[serde(rename = "retCode")]
9    pub code: String,
10    #[serde(rename = "retMsg")]
11    pub message: String,
12}
13
14impl Display for APIError {
15    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
16        write!(f, "<APIError> code={}, msg={}", self.code, self.message)
17    }
18}
19
20impl Error for APIError {}