Skip to content

fix(client): surface Bugzilla error messages instead of generic HTTP status - #139

Merged
kskarthik merged 1 commit into
openSUSE:mainfrom
lemenkov:handle_bugzilla_error
Sep 9, 2026
Merged

kskarthik merged 1 commit into
openSUSE:mainfrom
lemenkov:handle_bugzilla_error

Conversation

@lemenkov

@lemenkov lemenkov commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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.

…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
kskarthik self-requested a review September 9, 2026 07:30

@kskarthik kskarthik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good, thanks!

@kskarthik
kskarthik merged commit ce83b10 into openSUSE:main Sep 9, 2026
4 checks passed
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.

2 participants