Skip to main content

hpx_fastwebsockets/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum WebSocketError {
5  #[error("Invalid fragment")]
6  InvalidFragment,
7  #[error("Invalid UTF-8")]
8  InvalidUTF8,
9  #[error("Invalid continuation frame")]
10  InvalidContinuationFrame,
11  #[error("Invalid status code: {0}")]
12  InvalidStatusCode(u16),
13  #[error("Invalid upgrade header")]
14  InvalidUpgradeHeader,
15  #[error("Invalid connection header")]
16  InvalidConnectionHeader,
17  #[error("Connection is closed")]
18  ConnectionClosed,
19  #[error("Invalid close frame")]
20  InvalidCloseFrame,
21  #[error("Invalid close code")]
22  InvalidCloseCode,
23  #[error("Unexpected EOF")]
24  UnexpectedEOF,
25  #[error("Reserved bits are not zero")]
26  ReservedBitsNotZero,
27  #[error("Control frame must not be fragmented")]
28  ControlFrameFragmented,
29  #[error("Ping frame too large")]
30  PingFrameTooLarge,
31  #[error("Frame too large")]
32  FrameTooLarge,
33  #[error("Sec-Websocket-Version must be 13")]
34  InvalidSecWebsocketVersion,
35  #[error("Invalid value")]
36  InvalidValue,
37  #[error("Sec-WebSocket-Key header is missing")]
38  MissingSecWebSocketKey,
39  #[error(transparent)]
40  IoError(#[from] std::io::Error),
41  #[cfg(feature = "upgrade")]
42  #[error(transparent)]
43  HTTPError(#[from] hyper::Error),
44  #[cfg(feature = "unstable-split")]
45  #[error("Failed to send frame")]
46  SendError(#[from] Box<dyn std::error::Error + Send + Sync + 'static>),
47}