pub fn parse_error(response: &Value) -> ErrorExpand description
Parses an OKX API error response and converts it to a ccxt-core Error.
OKX API responses follow this format:
{
"code": "50001",
"msg": "Invalid API key",
"data": []
}§Arguments
response- The JSON response from OKX API
§Returns
A ccxt-core Error mapped from the OKX error code.
§Example
use ccxt_exchanges::okx::error::parse_error;
use serde_json::json;
let response = json!({
"code": "50001",
"msg": "Invalid API key"
});
let error = parse_error(&response);
assert!(error.as_authentication().is_some());