pub enum WsClientError {
UnexpectedResponse,
RequestError(Error),
UrlParseError(ParseError),
ServerError {
code: i32,
message: String,
},
ClientError {
code: i32,
message: String,
},
ConnectionClosed {
reason: Option<WsCloseReason>,
},
WsError(Box<Error>),
ProstError(DecodeError),
}Expand description
WebSocket客户端错误类型
定义WebSocket连接和通信过程中可能出现的各种错误
Variants§
UnexpectedResponse
返回体缺少预期字段。
RequestError(Error)
端点查询 HTTP 请求失败。
UrlParseError(ParseError)
WebSocket 地址解析失败。
ServerError
服务端返回业务错误。
ClientError
客户端侧参数或状态错误。
ConnectionClosed
连接被关闭。
Fields
§
reason: Option<WsCloseReason>The reason the connection was closed
WsError(Box<Error>)
WebSocket 传输错误。
ProstError(DecodeError)
Protobuf 解码错误。
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 Freeze for WsClientError
impl !RefUnwindSafe for WsClientError
impl Send for WsClientError
impl Sync for WsClientError
impl Unpin for WsClientError
impl UnsafeUnpin for WsClientError
impl !UnwindSafe 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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request