#[non_exhaustive]pub enum HlError {
Show 14 variants
Signing {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
Serialization {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
Http {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
Timeout {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
WebSocket {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
Api {
status: u16,
body: String,
},
Rejected {
reason: String,
},
InvalidAddress(String),
RateLimited {
retry_after_ms: u64,
message: String,
},
Parse(String),
Validation(String),
Config(String),
WsCancelled,
WsReconnectExhausted {
attempts: u32,
},
}Expand description
Errors that can occur in Hyperliquid operations.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Signing
An error occurred during EIP-712 signing.
Fields
Serialization
An error occurred during serialization or deserialization.
Fields
Http
An HTTP transport error (connection refused, DNS failure, etc.).
Fields
Timeout
The request timed out before receiving a response.
Fields
WebSocket
A WebSocket transport error (connection lost, frame error, etc.).
Fields
Api
The API returned a non-2xx HTTP status code.
Rejected
The exchange rejected the order.
InvalidAddress(String)
The provided Ethereum address is invalid.
RateLimited
The API returned HTTP 429 (rate limited).
Fields
Parse(String)
A JSON or data parsing error.
Validation(String)
An input validation error (bad parameters, invalid amounts, unknown assets).
Config(String)
A configuration error (invalid settings, missing keys, etc.).
WsCancelled
The WebSocket reconnect loop was cancelled.
WsReconnectExhausted
The WebSocket reconnect loop exhausted all retry attempts.
Implementations§
Source§impl HlError
impl HlError
Sourcepub fn http(message: impl Into<String>) -> Self
pub fn http(message: impl Into<String>) -> Self
Create an Http error without an underlying source.
Sourcepub fn timeout(message: impl Into<String>) -> Self
pub fn timeout(message: impl Into<String>) -> Self
Create a Timeout error without an underlying source.
Sourcepub fn signing(message: impl Into<String>) -> Self
pub fn signing(message: impl Into<String>) -> Self
Create a Signing error without an underlying source.
Sourcepub fn serialization(message: impl Into<String>) -> Self
pub fn serialization(message: impl Into<String>) -> Self
Create a Serialization error without an underlying source.
Sourcepub fn websocket(message: impl Into<String>) -> Self
pub fn websocket(message: impl Into<String>) -> Self
Create a WebSocket error without an underlying source.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Returns true if the error is retryable (network timeout, 5xx, or 429).
Sourcepub fn retry_after_ms(&self) -> Option<u64>
pub fn retry_after_ms(&self) -> Option<u64>
If this is a RateLimited error, returns the suggested wait time in milliseconds.
Trait Implementations§
Source§impl Error for HlError
impl Error for HlError
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()