pub enum MarketDataError {
Show 13 variants
InvalidSymbol {
symbol: String,
},
InvalidParameter {
name: String,
reason: String,
},
DeserializationError {
source: Error,
},
RuntimeError {
msg: String,
},
ConfigError(String),
ConnectionError {
msg: String,
},
AuthError {
msg: String,
},
ApiError {
status: u16,
message: String,
},
TimeoutError {
operation: String,
},
WebSocketError {
kind: WebSocketErrorKind,
msg: String,
},
HeartbeatTimeout {
elapsed: Duration,
},
ClientClosed,
Other(Error),
}Expand description
Main error type for marketdata-core operations
Variants§
InvalidSymbol
Invalid symbol format or unsupported symbol
InvalidParameter
Invalid or missing parameter
Fields
DeserializationError
JSON deserialization failed
RuntimeError
Runtime operation failed
ConfigError(String)
Configuration error
ConnectionError
Connection to server failed
AuthError
Authentication failed
ApiError
API returned error response
Fields
TimeoutError
Operation timed out
WebSocketError
WebSocket error
Fields
kind: WebSocketErrorKindStructured classification of the underlying WebSocket failure.
Branch on this rather than substring-matching msg for
programmatic decision-making (retry, alert, fail fast).
HeartbeatTimeout
Inbound activity timed out: no frame received within the
configured heartbeat_timeout window.
ClientClosed
Client has been closed and cannot be reused
Other(Error)
Other unexpected errors
Implementations§
Source§impl MarketDataError
impl MarketDataError
Sourcepub fn source_kind(&self) -> ErrorKind
pub fn source_kind(&self) -> ErrorKind
Coarse-grained classification of the source of this error.
Returns one of ErrorKind::Network, ErrorKind::Protocol,
ErrorKind::Auth, ErrorKind::RateLimit, or ErrorKind::Client
so downstream code can branch on category without pattern-matching
every variant.
§Mapping
MarketDataError variant | ErrorKind |
|---|---|
ConnectionError, TimeoutError, HeartbeatTimeout | Network |
WebSocketError { kind: Protocol | Capacity | Utf8 | Other } | Protocol |
WebSocketError { kind: Tls } | Auth |
WebSocketError { kind: Io } | Network |
WebSocketError { kind: Http(_) } | see WebSocketErrorKind::Http for the status-code mapping table |
AuthError, ApiError { status: 401 | 403 } | Auth |
ApiError { status: 429 } | RateLimit |
ApiError { status: 500..=599 } | Network |
ApiError { status: other 4xx } | Client |
InvalidSymbol, InvalidParameter, ConfigError, DeserializationError, ClientClosed | Client |
RuntimeError, Other | Client |
Sourcepub fn to_error_code(&self) -> i32
pub fn to_error_code(&self) -> i32
Get numeric error code for FFI consumers
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if error is retryable.
§WebSocket retry verdict (0.6.0+)
Refined to honour WebSocketErrorKind:
| Kind | Retryable |
|---|---|
Protocol, Capacity, Utf8, Tls | no |
Io, Other | yes |
Http(429), Http(500..=599) | yes |
Http(401 | 403) | no |
Http(other) | no |
Protocol violations are now correctly non-retryable — retrying the same SDK against the same server will keep failing. Pre-0.6.0 behaviour treated every WebSocket error as retryable, which was a footgun for monitor incident response.
Trait Implementations§
Source§impl Debug for MarketDataError
impl Debug for MarketDataError
Source§impl Display for MarketDataError
impl Display for MarketDataError
Source§impl Error for MarketDataError
impl Error for MarketDataError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()