#[non_exhaustive]pub enum SpotWsError {
Connect(WsError),
ConnectTimeout(Duration),
Closed {
code: Option<u16>,
reason: String,
},
Refused {
code: i64,
msg: String,
},
NoAnswer {
id: u64,
timeout: Duration,
},
Response {
id: u64,
raw: String,
},
TooManyStreams {
path: StreamPath,
limit: usize,
},
Frame {
stream: String,
raw: String,
reason: String,
},
Stopped {
cause: Option<StopCause>,
},
}Expand description
Error type for the spot socket tiers.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Connect(WsError)
The connection could not be opened, or failed mid-stream: the kit’s
one socket error, read through its Kind. A
server close and a connect timeout have variants of their own.
ConnectTimeout(Duration)
The connection did not open within the connect timeout.
Closed
The server closed the connection, with its close code and reason when
it sent them: 1008 "Too many requests" after more than 5 incoming
messages in a second.
Refused
The server answered a request with {"error": {"code", "msg"}}.
NoAnswer
No answer to a request, or no pong to a ping (id 0), within the answer timeout.
Response
An answer that was not the documented shape.
TooManyStreams
A subscribe that would take a connection past Binance’s cap. Nothing was sent: a 1025th stream is not one the client probes, since the server’s answer to it closes the connection and loses all 1024.
Frame
A text frame that did not decode as an update.
Fields
Stopped
The supervised tier has stopped; its handles can no longer be used.
cause is the error a path stopped on, as Classify read it, so a
stream stopped by a reconnect refused with 451 is classed and tagged as
that refusal is. None when the client stopped for another reason,
such as a task that panicked, or before the stop’s cause was known.
Trait Implementations§
Source§impl Classify for SpotWsError
The transport by the one socket table
(polyoxide_venue::impl_ws_classification!), a server close by its close
code, a refused request a VenueRefusal with Binance’s code in decimal,
an answer or frame that did not parse a Decode, and the client’s own
refusals an InvalidRequest.
impl Classify for SpotWsError
The transport by the one socket table
(polyoxide_venue::impl_ws_classification!), a server close by its close
code, a refused request a VenueRefusal with Binance’s code in decimal,
an answer or frame that did not parse a Decode, and the client’s own
refusals an InvalidRequest.
One row is Binance’s own, ahead of the table (D14): a handshake refused
with 403 is Restricted, as on REST. Binance’s firewall answers it, and
it is not a credential failure, since the streams need none.
Every error is a fault except a handshake refused with 451: Binance does
not serve the caller’s region, a defined outcome, as
SpotError::RegionBlocked is on
REST. A 418 ban and a 403 from the firewall stay faults. A refused
handshake’s Retry-After, of any status, is the error’s wait.
Stopped follows its cause, so a stop on a 451
refusal is Restricted and not a fault; one with no cause is an
InvalidRequest and a fault.
Source§fn is_fault(&self) -> bool
fn is_fault(&self) -> bool
Source§fn retry_after(&self) -> Option<Duration>
fn retry_after(&self) -> Option<Duration>
Some of zero.Source§fn is_retriable(&self) -> bool
fn is_retriable(&self) -> bool
Class::is_retriable).Source§impl Debug for SpotWsError
impl Debug for SpotWsError
Source§impl Display for SpotWsError
impl Display for SpotWsError
Source§impl Error for SpotWsError
impl Error for SpotWsError
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()
Source§impl From<WsError> for SpotWsError
A server close is SpotWsError::Closed, a connect timeout
SpotWsError::ConnectTimeout, and every other socket failure
SpotWsError::Connect.
impl From<WsError> for SpotWsError
A server close is SpotWsError::Closed, a connect timeout
SpotWsError::ConnectTimeout, and every other socket failure
SpotWsError::Connect.
Auto Trait Implementations§
impl !RefUnwindSafe for SpotWsError
impl !UnwindSafe for SpotWsError
impl Freeze for SpotWsError
impl Send for SpotWsError
impl Sync for SpotWsError
impl Unpin for SpotWsError
impl UnsafeUnpin for SpotWsError
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.