Error handling
Error hierarchy
Error
└─ HyperliquidError
├─ ValidationError
├─ AbstractWalletError
├─ TransportError
│ ├─ HttpRequestError
│ └─ WebSocketRequestError
└─ ApiRequestErrorTransport errors
HttpRequestError
import { HttpRequestError } from "@nktkas/hyperliquid";
try {
await client.allMids();
} catch (error) {
if (error instanceof HttpRequestError) {
console.error(error.message); // "429 Too Many Requests - ..."
console.error(error.response?.status); // 429
console.error(await error.response?.text()); // response body
}
}WebSocketRequestError
API errors
Wallet errors
Validation errors
Timeouts and cancellation
Catch all errors
Last updated