Expand description
Error types for Bybit API
Comprehensive error handling for SDK operations.
§Example
use rusty_bybit::{BybitError, BybitClient};
#[tokio::main]
async fn main() {
let client = BybitClient::testnet();
match client.get_server_time().await {
Ok(time) => println!("Server time: {}", time.time_second),
Err(BybitError::ApiError { ret_code, ret_msg }) => {
if ret_code == 10006 {
eprintln!("Rate limit exceeded: {}", ret_msg);
} else if ret_code == 110004 {
eprintln!("Insufficient balance: {}", ret_msg);
} else {
eprintln!("API error {}: {}", ret_code, ret_msg);
}
}
Err(e) => eprintln!("Error: {}", e),
}
}