-
Notifications
You must be signed in to change notification settings - Fork 0
feat: enhance API client robustness with improved error handling #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… parameter handling ## Summary This commit refactors multiple API endpoint definitions across various modules to utilize the `quote` function from `urllib.parse`. This change ensures that URL parameters are properly encoded, enhancing the safety and reliability of API calls. ## Key Changes - Updated URL formatting in API calls to replace f-strings with `.format()` method using `quote` for `graph_id`, `agent_type`, `backup_id`, `org_id`, `subscription_id`, `user_id`, and other parameters. - Ensured consistent handling of special characters in URLs to prevent potential issues with API requests. ## Files Affected - Multiple files across the `agent`, `backup`, `billing`, `connections`, `credits`, `files`, `graph_health`, `graph_info`, `graph_limits`, `org`, `org_members`, `org_usage`, `query`, `schema`, `subgraphs`, `subscriptions`, `tables`, `usage`, and `user` modules. ## Testing Notes - Verify that all API calls function correctly with the updated URL formatting. - Ensure that any existing tests cover the modified endpoints to validate the changes. ## Infrastructure Considerations This change improves the robustness of API interactions by ensuring that all parameters are safely encoded, reducing the risk of errors during API requests.
## Summary This commit enhances the error handling mechanism in the `QueryClient` class to better manage HTTP error responses (4xx/5xx). It provides clearer error messages by parsing the response content and extracting relevant details. ## Key Changes - Added logic to handle error responses where the parsed response is `None`. - Improved exception messages to include HTTP status codes and detailed error information from the response body. ## Testing Notes - Verify that the error handling works correctly for various HTTP error scenarios. - Ensure that the exceptions raised provide meaningful information for debugging. ## Infrastructure Considerations This change improves the robustness of the `QueryClient` by ensuring that errors are reported with more context, aiding in troubleshooting and enhancing overall reliability.
|
@claude please review this PR |
|
Claude finished @jfrench9's task in 1m 51s —— View job PR Review CompleteTasks
SummaryThis PR implements two key improvements to the RoboSystems API client:
Both changes are well-implemented and improve the robustness of the client. However, there are a few considerations worth discussing. ✅ Strengths1. Comprehensive URL Encoding (robosystems_client/api/**/*)
Example pattern (consistently applied): from urllib.parse import quote
"url": "/v1/graphs/{graph_id}/agent/{agent_type}".format(
graph_id=quote(str(graph_id), safe=""),
agent_type=quote(str(agent_type), safe=""),
)2. Improved Error Handling (robosystems_client/extensions/query_client.py:269-284)
|
Summary
This PR significantly enhances the robustness and reliability of the RoboSystems API client by implementing comprehensive error handling improvements and safer URL parameter handling across all API endpoints.
Key Accomplishments
Breaking Changes
None. These changes are backward-compatible and only enhance the existing functionality without modifying public APIs.
Testing Notes
Infrastructure Considerations
🤖 Generated with Claude Code
Branch Info:
feature/more-robust-genmainCo-Authored-By: Claude noreply@anthropic.com