Skip to content

Conversation

@spacexbt
Copy link
Owner

This PR adds enhanced error handling utilities to improve the robustness of the SDK:

  1. Added new error handling utilities:

    • Custom exception classes for better error handling
    • Address validation function
    • Numeric parameter validation
    • Retry mechanism with exponential backoff
  2. Key improvements:

    • Better error messages for invalid parameters
    • Automatic retries for failed API calls
    • Input validation for common parameters
    • Type-safe error handling
  3. Usage example:

from hyperliquid.utils.error_handling import retry_on_failure, validate_address

# Validate Ethereum addresses
address = "0x..."
if not validate_address(address):
    raise InvalidParameterError("Invalid Ethereum address")

# Add retry mechanism to API calls
@retry_on_failure(max_retries=3)
def make_api_call():
    # Your API call here
    pass

This will help make the SDK more robust and user-friendly by providing better error handling and validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants