pub enum WebSocketError {
Show 22 variants
InvalidFragment,
FragmentTimeout,
InvalidUTF8,
InvalidContinuationFrame,
InvalidStatusCode(u16),
InvalidUpgradeHeader,
InvalidConnectionHeader,
ConnectionClosed,
InvalidCloseFrame,
InvalidCloseCode,
ReservedBitsNotZero,
ControlFrameFragmented,
PingFrameTooLarge,
FrameTooLarge,
InvalidSecWebsocketVersion,
InvalidOpCode(u8),
MissingSecWebSocketKey,
InvalidHttpScheme,
CompressionNotSupported,
UrlParseError(ParseError),
IoError(Error),
HTTPError(Error),
}Expand description
Errors that can occur during WebSocket operations.
Variants§
InvalidFragment
Invalid fragment sequence.
FragmentTimeout
Fragmented message timed out.
InvalidUTF8
Payload contains invalid UTF-8.
InvalidContinuationFrame
Continuation frame without initial frame.
InvalidStatusCode(u16)
HTTP status code not valid for WebSocket upgrade.
InvalidUpgradeHeader
Missing or invalid “Upgrade: websocket” header.
InvalidConnectionHeader
Missing or invalid “Connection: upgrade” header.
ConnectionClosed
Connection has been closed.
InvalidCloseFrame
Close frame has invalid format.
InvalidCloseCode
Close frame contains invalid status code.
ReservedBitsNotZero
Reserved bits in frame header are not zero.
ControlFrameFragmented
Control frame is fragmented.
PingFrameTooLarge
Ping frame exceeds 125 bytes.
FrameTooLarge
Frame payload exceeds configured maximum.
InvalidSecWebsocketVersion
Sec-WebSocket-Version is not 13.
InvalidOpCode(u8)
Invalid frame opcode.
MissingSecWebSocketKey
Missing Sec-WebSocket-Key header.
InvalidHttpScheme
URL scheme is not ws:// or wss://.
CompressionNotSupported
Received compressed frame but compression not negotiated.
UrlParseError(ParseError)
URL parsing error.
IoError(Error)
I/O error.
HTTPError(Error)
Hyper HTTP error.
Implementations§
Source§impl WebSocketError
impl WebSocketError
Sourcepub fn is_protocol_error(&self) -> bool
Available on non-WebAssembly only.
pub fn is_protocol_error(&self) -> bool
Returns true if this is a protocol-level error (RFC 6455 violation).
Sourcepub fn is_handshake_error(&self) -> bool
Available on non-WebAssembly only.
pub fn is_handshake_error(&self) -> bool
Returns true if this is a handshake error.
Sourcepub fn is_data_error(&self) -> bool
Available on non-WebAssembly only.
pub fn is_data_error(&self) -> bool
Returns true if this is a data validation error (invalid UTF-8 or size limit).
Sourcepub fn is_io_error(&self) -> bool
Available on non-WebAssembly only.
pub fn is_io_error(&self) -> bool
Returns true if this wraps an I/O error.
Sourcepub fn as_io_error(&self) -> Option<&Error>
Available on non-WebAssembly only.
pub fn as_io_error(&self) -> Option<&Error>
Returns the underlying I/O error, if any.
Trait Implementations§
Source§impl Debug for WebSocketError
impl Debug for WebSocketError
Source§impl Display for WebSocketError
impl Display for WebSocketError
Source§impl Error for WebSocketError
impl Error for WebSocketError
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()