#[non_exhaustive]pub enum WebSocketErrorKind {
Protocol,
Capacity,
Utf8,
Tls,
Io,
Http(u16),
Other,
}Expand description
Coarse-grained classification of the source of a MarketDataError.
Returned by MarketDataError::source_kind so downstream code can branch
on the category of failure (network glitch vs SDK / protocol bug vs
auth vs caller-side validation) without pattern-matching every variant or
string-matching the embedded msg.
The enum is #[non_exhaustive] so future variants can be added in a
minor release without breaking exhaustive matches.
Refined classification of a MarketDataError::WebSocketError.
Mirrors tungstenite::Error’s own categorization without leaking the
upstream dependency type. Returned by pattern-matching the structured
kind field on the variant.
The enum is #[non_exhaustive] so future tungstenite releases or
new error sources can add variants without breaking exhaustive matches.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Protocol
Protocol-level violation: malformed frame, illegal state transition, reserved bits set. Never retryable — indicates an SDK / version mismatch or a server-side bug.
Capacity
Frame exceeded the configured max_message_size / max_frame_size.
Never retryable; the producer is misbehaving.
Utf8
UTF-8 decoding failed on a text frame. Never retryable; the producer emitted invalid bytes.
Tls
TLS / certificate failure during the WebSocket handshake. Treated as authentication-adjacent — never retryable without operator action.
Io
Transport IO failure: connection reset, EOF, write error, etc. Retryable with backoff.
Http(u16)
HTTP error during the WebSocket upgrade. u16 is the status code.
§Status code mapping
Authoritative grid for monitor / incident-classifier code that
branches on WebSocketErrorKind::Http(_). MarketDataError::source_kind
and MarketDataError::is_retryable honour this exact mapping; the
#[cfg(test)] http_mapping_consistency module in this file pins
the doc-vs-impl contract so silent drift fails CI.
| Status range | ErrorKind | is_retryable |
|---|---|---|
401, 403 | Auth | false |
429 | RateLimit | true |
500..=599 | Network | true |
other 4xx (e.g. 404) | Client | false |
| anything else | Client | false |
Auth and Client failures are non-retryable because the upstream
rejection will not change between attempts; RateLimit and 5xx
retry with the configured backoff. Other 4xx codes (including 404)
surface as Client rather than Network because the server has
stated, conclusively, that the request is wrong.
Other
Anything tungstenite adds in the future, or an error we can’t
classify. Retryable (conservative default).
Trait Implementations§
Source§impl Clone for WebSocketErrorKind
impl Clone for WebSocketErrorKind
Source§fn clone(&self) -> WebSocketErrorKind
fn clone(&self) -> WebSocketErrorKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WebSocketErrorKind
impl Debug for WebSocketErrorKind
Source§impl Hash for WebSocketErrorKind
impl Hash for WebSocketErrorKind
Source§impl PartialEq for WebSocketErrorKind
impl PartialEq for WebSocketErrorKind
Source§fn eq(&self, other: &WebSocketErrorKind) -> bool
fn eq(&self, other: &WebSocketErrorKind) -> bool
self and other values to be equal, and is used by ==.impl Copy for WebSocketErrorKind
impl Eq for WebSocketErrorKind
impl StructuralPartialEq for WebSocketErrorKind
Auto Trait Implementations§
impl Freeze for WebSocketErrorKind
impl RefUnwindSafe for WebSocketErrorKind
impl Send for WebSocketErrorKind
impl Sync for WebSocketErrorKind
impl Unpin for WebSocketErrorKind
impl UnsafeUnpin for WebSocketErrorKind
impl UnwindSafe for WebSocketErrorKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.