Description
Problem
The RPC service currently has inconsistent error handling for different HTTP status codes. Some status codes are handled with generic errors, making it difficult to:
- Debug issues
- Handle specific error cases in the application
- Provide meaningful error messages to users
Proposed Solution
Improve error handling by implementing specific error types for different HTTP status codes:
- 401: Unauthorized error
- 402/404/5xx: Resource unavailable error
- 405/501: Method not found error
- 429: Rate limiting error
- Other 4xx: Invalid request error
- Invalid JSON: Parse error
Benefits
- More predictable error handling
- Better debugging capabilities
- Clearer error messages for users
- Consistent error data structure
- Improved test coverage and documentation
Testing
- Verify all HTTP status codes are handled correctly
- Ensure error messages are consistent
- Check that error data includes necessary information
- Run existing test suite to confirm no regressions