pub enum WebSocketError {
ConnectionFailed(String),
AuthenticationFailed(String),
SubscriptionFailed(String),
InvalidMessage(String),
ConnectionClosed,
HeartbeatTimeout,
ApiError {
code: i64,
message: String,
method: Option<String>,
params: Option<Value>,
raw_response: Option<String>,
},
Timeout(String),
DispatcherDead,
Serialization(Error),
}Expand description
WebSocket-specific errors
Variants§
ConnectionFailed(String)
Connection failed with error message
AuthenticationFailed(String)
Authentication failed with error message
SubscriptionFailed(String)
Subscription failed with error message
InvalidMessage(String)
Invalid message format
ConnectionClosed
Connection was closed
HeartbeatTimeout
Heartbeat timeout occurred
ApiError
API error returned by Deribit, enriched with request + response context for debugging.
The base Display form is "API error <code>: <message>" so
callers that only call .to_string() see the legacy shape. When
method and/or params are present the suffix
" (method=..., params=<truncated JSON>)" is appended; params
is truncated to the first 512 characters.
Sensitive keys (access_token, refresh_token, client_secret,
signature, password) inside params and raw_response are
recursively replaced with "***" at construction time, before
the value is stored — Debug output is therefore also safe.
Fields
Timeout(String)
Operation timed out (e.g., send_request awaiting a matching response)
DispatcherDead
The background dispatcher task is not running (never started, shut down, or panicked). No further I/O can be performed through it.
Serialization(Error)
JSON serialization or deserialization failed.
Typically raised when a request contains a numeric field whose value
cannot be represented in JSON (e.g. NaN or Infinity in an f64),
or when parsing a malformed response payload.
Implementations§
Source§impl WebSocketError
impl WebSocketError
Sourcepub fn api_error_from_parts(
request: &JsonRpcRequest,
error: JsonRpcError,
raw_response: Option<String>,
) -> Self
pub fn api_error_from_parts( request: &JsonRpcRequest, error: JsonRpcError, raw_response: Option<String>, ) -> Self
Construct an enriched ApiError from the originating request and
the server-side error payload.
Applies recursive, case-insensitive redaction of the sensitive
keys access_token, refresh_token, client_secret,
signature, and password to both params (cloned from
request) and the caller-supplied raw_response before storing
them, so the returned value is safe to log or surface through
Display / Debug.
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()