Skip to content

Handle SSLError and ParsingError in error wrapping#11

Merged
delano merged 1 commit intomainfrom
fix/5-connection-error-body-validation
Apr 2, 2026
Merged

Handle SSLError and ParsingError in error wrapping#11
delano merged 1 commit intomainfrom
fix/5-connection-error-body-validation

Conversation

@delano
Copy link
Copy Markdown
Member

@delano delano commented Apr 2, 2026

Summary

  • Add rescue clauses for Faraday::SSLError and Faraday::ParsingError in HttpClient
  • Order SSLError before ConnectionFailed (SSLError is a subclass)
  • Non-JSON error responses now handled gracefully (returns response_body: nil)

Test plan

  • Verify SSL failures raise ConnectionError with descriptive message
  • Verify parsing errors raise Error with underlying cause
  • Verify non-JSON 500 responses return proper HttpRequestError with nil body

- Add rescue clauses for Faraday::SSLError and Faraday::ParsingError
- Order SSLError before ConnectionFailed (SSLError is a subclass)
- Update CLAUDE.md error hierarchy with ConnectionError, AuthenticationError, RateLimitError
- Add tests for non-JSON body handling, SSL failures, and parsing errors
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the SDK's error handling by explicitly rescuing SSL and parsing errors within the HTTP client, updating the error hierarchy documentation, and adding comprehensive test coverage for these scenarios. The review feedback suggests improving the parsing error rescue by preserving the original exception cause and utilizing a more specific error class to maintain consistency with the rest of the library's error structure.

@delano delano merged commit 6b5c0a6 into main Apr 2, 2026
8 checks passed
@delano delano deleted the fix/5-connection-error-body-validation branch April 2, 2026 05:36
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.

1 participant