pub enum Error {
Io(Error),
Protocol(ProtocolError),
Encode(EncodeError),
Handshake(HandshakeError),
Tls(TlsError),
InvalidUrl(String),
TlsNotEnabled,
}Expand description
Unified error type for WebSocket stream operations.
Variants§
Io(Error)
I/O error from the underlying stream.
Protocol(ProtocolError)
WebSocket protocol error.
Encode(EncodeError)
Encoding error (e.g., control frame payload too large).
Handshake(HandshakeError)
HTTP handshake failed.
Tls(TlsError)
TLS error during connection setup (handshake, certificate validation, SNI hostname verification).
Steady-state TLS protocol errors (decrypt failure, peer
alert, malformed record received during a frame) on the async
nexus-async-web paths surface as Error::Io
instead — the underlying TlsError is
wrapped via io::Error::other and reachable via
io_err.source() or io_err.get_ref(). This asymmetry stems
from the WireStream trait returning
io::Result for poll methods. Sync WS surfaces Tls directly
because its TlsStream exposes TlsError natively. Pattern-
match on both Io and Tls if you need to distinguish TLS-
protocol failures from generic transport failures across both
surfaces.
InvalidUrl(String)
Invalid WebSocket URL.
TlsNotEnabled
wss:// URL used without the tls feature enabled.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · 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()