fix(client): surface Bugzilla error messages instead of generic HTTP status - #139
Merged
Merged
Conversation
…status Every request duplicated the same try/except and re-raised the raw httpx.HTTPStatusError, whose message is only "400 Bad Request" — Bugzilla's own diagnostic (e.g. "changedafter is not a valid field name") was logged but never reached the caller, so a model could not correct its query. The raw httpx message also embeds the full request URL, including the api_key query parameter, and was being forwarded to the caller via ToolError. Centralize request handling in Bugzilla._request. Caller-fixable HTTP errors now raise the existing BugzillaAPIError (JSON body) or BugzillaResponseError (non-JSON body), matching what _json_or_raise already raises for 200-with-error responses, so callers see one error vocabulary and never a raw URL. Network errors are re-raised untouched. Collapses thirteen duplicated blocks. The httpx cause is not chained (`from None`): the [BZ-REQ]/[BZ-RES] log lines already record the request and response key-free, and chaining would re-expose the full URL in the traceback. Signed-off-by: Peter Lemenkov <lemenkov@gmail.com> Assisted-by: Claude (Anthropic) <https://claude.ai>
kskarthik
self-requested a review
September 9, 2026 07:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Every request duplicated the same try/except and re-raised the raw httpx.HTTPStatusError, whose message is only "400 Bad Request" — Bugzilla's own diagnostic (e.g. "changedafter is not a valid field name") was logged but never reached the caller, so a model could not correct its query. The raw httpx message also embeds the full request URL, including the api_key query parameter, and was being forwarded to the caller via ToolError.
Centralize request handling in Bugzilla._request. Caller-fixable HTTP errors now raise the existing BugzillaAPIError (JSON body) or BugzillaResponseError (non-JSON body), matching what _json_or_raise already raises for 200-with-error responses, so callers see one error vocabulary and never a raw URL. Network errors are re-raised untouched. Collapses thirteen duplicated blocks.
The httpx cause is not chained (
from None): the [BZ-REQ]/[BZ-RES] log lines already record the request and response key-free, and chaining would re-expose the full URL in the traceback.