Fix exception handling in select_all to raise errors instead of returning empty results #59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #50 -
select_alland related methods now properly raiseDbExceptionwhen ClickHouse returns error responses, instead of silently returning empty results.Problem
When ClickHouse returns error responses with an 'exception' field in the JSON body (but without HTTP error codes or exception headers), the
Response::Factory.responsemethod was silently treating these as empty result sets instead of raising exceptions. This caused invalid queries likeSELECT unknownFunction()to return[]instead of raising a proper error.Solution
Added exception detection in
Response::Factory.responsebefore processing the response body. When the body is a Hash containing an 'exception' key, it now raisesDbExceptionwith the error message from ClickHouse.Key changes:
lib/click_house/response/factory.rb- Added 4 lines to check for exception field and raise DbExceptionTesting
Code Quality
🤖 Generated with Claude Code