pub struct WsError(/* private fields */);Expand description
A WebSocket failure: a transport error, a refused upgrade, a server close, or one of the kit’s own timeouts.
Opaque on purpose: read it through kind, which no later
tungstenite release can break, and classify it through
polyoxide_venue::impl_ws_classification! in the venue crate that wraps
it. Its source is the transport error it came from, when there is one.
Built from a tungstenite::Error by From, and by
connect_timeout, closed,
from_close_frame and
no_answer for the failures the kit detects itself.
The basis is the boxed tungstenite::Error each socket crate wrapped:
the errors of all five socket crates wrap this type instead since Stories
4.6 to 4.10. One divergence row stays with each venue: D19, what to do
after Kind::AlreadyClosed (some venues stop, others reconnect).
Implementations§
Source§impl WsError
impl WsError
Sourcepub fn connect_timeout(after: Duration) -> Self
pub fn connect_timeout(after: Duration) -> Self
The connection did not open within after.
Sourcepub fn closed(code: Option<u16>, reason: impl Into<String>) -> Self
pub fn closed(code: Option<u16>, reason: impl Into<String>) -> Self
The server closed the connection with this code and reason; None
and an empty reason for a close frame without a code, or an end of the
stream with no close frame.
Sourcepub fn from_close_frame(frame: Option<&CloseFrame>) -> Self
pub fn from_close_frame(frame: Option<&CloseFrame>) -> Self
The server closed the connection with this close frame, or with none.
Trait Implementations§
Source§impl Error for WsError
impl Error for WsError
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()