#[non_exhaustive]pub enum UsdmWsError {
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,
},
WrongPath {
stream: StreamName,
path: StreamPath,
},
Frame {
stream: String,
raw: String,
reason: String,
},
Stopped {
cause: Option<StopCause>,
},
}Expand description
Error type for the 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 a burst of requests,
1008 "Invalid request" after a refused 1025th stream.
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: the server answers the 1025th stream with an error and then closes the connection, losing all 1024.
WrongPath
A stream for the other path, on the bare tier. Nothing was sent.
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 UsdmWsError
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 UsdmWsError
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
UsdmError::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 UsdmWsError
impl Debug for UsdmWsError
Source§impl Display for UsdmWsError
impl Display for UsdmWsError
Source§impl Error for UsdmWsError
impl Error for UsdmWsError
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 UsdmWsError
A server close is UsdmWsError::Closed, a connect timeout
UsdmWsError::ConnectTimeout, and every other socket failure
UsdmWsError::Connect.
impl From<WsError> for UsdmWsError
A server close is UsdmWsError::Closed, a connect timeout
UsdmWsError::ConnectTimeout, and every other socket failure
UsdmWsError::Connect.
Auto Trait Implementations§
impl !RefUnwindSafe for UsdmWsError
impl !UnwindSafe for UsdmWsError
impl Freeze for UsdmWsError
impl Send for UsdmWsError
impl Sync for UsdmWsError
impl Unpin for UsdmWsError
impl UnsafeUnpin for UsdmWsError
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.