Skip to main content

WebSocketErrorKind

Enum WebSocketErrorKind 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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 rangeErrorKindis_retryable
401, 403Authfalse
429RateLimittrue
500..=599Networktrue
other 4xx (e.g. 404)Clientfalse
anything elseClientfalse

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

Source§

fn clone(&self) -> WebSocketErrorKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WebSocketErrorKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Hash for WebSocketErrorKind

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for WebSocketErrorKind

Source§

fn eq(&self, other: &WebSocketErrorKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for WebSocketErrorKind

Source§

impl Eq for WebSocketErrorKind

Source§

impl StructuralPartialEq for WebSocketErrorKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V