pub enum TransportError {
Io(Error),
Handshake(String),
InvalidUrl(String),
Tls(String),
Protocol(String),
ClosedByPeer(Option<CloseFrame>),
ConnectionClosed,
ConnectionReset,
MessageTooLarge,
FrameTooLarge,
InvalidUtf8,
Other(String),
}Expand description
A backend-agnostic WebSocket transport error.
Each backend translates its native error type into this enum via From impls
so the higher layers operate against a single error surface.
Variants§
Io(Error)
Underlying I/O error from the socket.
Handshake(String)
HTTP upgrade handshake failed.
InvalidUrl(String)
URL was invalid or unsupported.
Tls(String)
TLS-layer failure during connect or stream operation.
Protocol(String)
WebSocket protocol violation reported by the peer or detected locally.
ClosedByPeer(Option<CloseFrame>)
Peer sent a close frame and the connection is closing.
ConnectionClosed
Connection closed without a close frame (abnormal).
ConnectionReset
Connection reset by peer.
MessageTooLarge
Message exceeded the configured maximum size.
FrameTooLarge
Frame exceeded the configured maximum size.
InvalidUtf8
UTF-8 validation failed on a text frame.
Only emitted by backends that validate (e.g. tokio-tungstenite); the
in-house HFT backend does not validate and will not produce this.
Other(String)
Backend returned an error not covered by other variants. Carries a short description; consumers should treat as fatal.
Implementations§
Source§impl TransportError
impl TransportError
Sourcepub fn is_fatal(&self) -> bool
pub fn is_fatal(&self) -> bool
Returns true if the error indicates the connection is no longer usable.
InvalidUrl is the only non-fatal variant: a bad URL is a caller-side
configuration mistake that does not damage an existing connection.
Everything else (including Io and the catch-all Other) implies the
underlying transport cannot be reused.
Trait Implementations§
Source§impl Debug for TransportError
impl Debug for TransportError
Source§impl Display for TransportError
impl Display for TransportError
Source§impl Error for TransportError
impl Error for TransportError
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<Error> for TransportError
impl From<Error> for TransportError
Source§impl From<Error> for TransportError
impl From<Error> for TransportError
Auto Trait Implementations§
impl Freeze for TransportError
impl !RefUnwindSafe for TransportError
impl Send for TransportError
impl Sync for TransportError
impl Unpin for TransportError
impl UnsafeUnpin for TransportError
impl !UnwindSafe for TransportError
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.