Skip to main content

Error Hierarchy

Both SDKs share a nearly identical error class hierarchy. All errors extend from KaleidoError:
One divergence to be aware of: in TypeScript RateLimitError extends APIError, while in Python it extends KaleidoError directly — a Python except APIError handler will not catch rate-limit errors.

Base Error: KaleidoError

All SDK errors extend KaleidoError with these properties:

Specific Error Classes

APIError

Raised for HTTP errors (status 400-599).

RateLimitError

Raised when rate limit is exceeded (HTTP 429). Extends APIError in TypeScript; in Python it extends KaleidoError directly.

NetworkError

Raised for network connectivity issues (DNS failures, connection refused, etc.). Always retryable (isRetryable() returns true).

ValidationError

Raised for validation failures (HTTP 400, 422). Includes FastAPI validation error parsing.

TimeoutError

Raised when requests time out (HTTP 408, 504). Always retryable.

WebSocketError

Raised for WebSocket connection or communication errors.

NotFoundError

Raised when a resource is not found (HTTP 404).

ConfigError

Raised for SDK configuration issues (e.g., invalid URLs).

SwapError

Raised for swap operation failures.

NodeNotConfiguredError

Raised by the Python SDK when an RLN node operation is attempted without a configured node_url. TypeScript instead throws ConfigError (“Node API not configured. Provide “nodeUrl” when creating the client.”) when a client.rln.* method is called without nodeUrl.

QuoteExpiredError

Raised when attempting to use an expired quote.

InsufficientBalanceError

Raised when a balance is insufficient for the requested operation.

Comprehensive Error Handling

Retry Patterns

Use isRetryable() to implement automatic retries:

HTTP Error Mapping

The SDK automatically maps HTTP errors to typed exceptions using mapHttpError / map_http_error: Rather than hardcoding this table in your own retry logic, call isRetryable() / is_retryable() — it encodes exactly these rules and stays correct as the mapping evolves.