pub enum WsClientError {
Show 13 variants
UnexpectedResponse,
RequestError(Error),
UrlParseError(ParseError),
ServerError {
code: i32,
message: String,
},
ClientError {
code: i32,
message: String,
},
ConnectionClosed {
reason: Option<WsCloseReason>,
},
WsError(Box<Error>),
ProstError(DecodeError),
MalformedControlFrame {
message: String,
},
InvalidStateTransition {
kind: InvalidStateKind,
},
HandlerPanicked,
BacklogFull {
message: String,
},
InvalidFrameMethod {
method: i32,
},
}Expand description
WebSocket 客户端错误类型。
Variants§
UnexpectedResponse
返回体缺少预期字段。
RequestError(Error)
端点查询 HTTP 请求失败。
UrlParseError(ParseError)
WebSocket 地址解析失败。
ServerError
服务端返回业务错误。
ClientError
客户端侧参数或状态错误。
ConnectionClosed
连接被关闭。
Fields
§
reason: Option<WsCloseReason>关闭原因。
WsError(Box<Error>)
WebSocket 传输错误。
ProstError(DecodeError)
Protobuf 解码错误。
MalformedControlFrame
控制帧(如 pong)payload 非法。
InvalidStateTransition
会话状态不允许的操作(例如已关闭后继续处理业务帧)。
Fields
§
kind: InvalidStateKind结构化原因(测试与调用方可 match,勿依赖展示字符串)。
HandlerPanicked
用户 EventHandler 在 blocking 池中 panic。
BacklogFull
串行 handler 队列与本地 outbox 均已满。
InvalidFrameMethod
未知 protobuf frame method。
Trait Implementations§
Source§impl Debug for WsClientError
impl Debug for WsClientError
Source§impl Display for WsClientError
impl Display for WsClientError
Source§impl Error for WsClientError
impl Error for WsClientError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<DecodeError> for WsClientError
impl From<DecodeError> for WsClientError
Source§fn from(source: DecodeError) -> WsClientError
fn from(source: DecodeError) -> WsClientError
Converts to this type from the input type.
Source§impl From<Error> for WsClientError
impl From<Error> for WsClientError
Source§fn from(source: Error) -> WsClientError
fn from(source: Error) -> WsClientError
Converts to this type from the input type.
Source§impl From<Error> for WsClientError
impl From<Error> for WsClientError
Source§fn from(error: Error) -> WsClientError
fn from(error: Error) -> WsClientError
Converts to this type from the input type.
Source§impl From<ParseError> for WsClientError
impl From<ParseError> for WsClientError
Source§fn from(source: ParseError) -> WsClientError
fn from(source: ParseError) -> WsClientError
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for WsClientError
impl !UnwindSafe for WsClientError
impl Freeze for WsClientError
impl Send for WsClientError
impl Sync for WsClientError
impl Unpin for WsClientError
impl UnsafeUnpin for WsClientError
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
Mutably borrows from an owned value. Read more