Skip to content

fix(client): guard error response JSON parsing and map all non-2xx statuses - #1179

Closed
amir-rezaei wants to merge 1 commit into
Kohei-Wada:mainfrom
amir-rezaei:fix/client-error-handling-robustness
Closed

fix(client): guard error response JSON parsing and map all non-2xx statuses#1179
amir-rezaei wants to merge 1 commit into
Kohei-Wada:mainfrom
amir-rezaei:fix/client-error-handling-robustness

Conversation

@amir-rezaei

Copy link
Copy Markdown
Contributor

Description

This PR resolves issue #1146 by making error response handling in packages/taskdog-client/src/taskdog_client/base_client.py robust against non-JSON error payloads and unmapped HTTP status codes.

Details

  • Guards JSON decoding on 404 responses with contextlib.suppress so HTML 404 pages (e.g. from reverse proxies) do not crash with raw JSONDecodeError.
  • Preserves custom error details returned by the server on 401 response status codes.
  • Maps all remaining non-2xx status codes (403, 405, 409, 429, 5xx) to ServerError(status_code, detail) instead of leaking unhandled httpx.HTTPStatusError exceptions.

@Kohei-Wada

Copy link
Copy Markdown
Owner

Thanks for the contribution, but CI is failing on this PR (Test (taskdog-client)), and no fix has been pushed.

Closing to keep the review queue actionable. Please feel free to reopen once:

  • all required checks pass on your branch, and
  • the change is covered by tests that pass locally (make check && make test).

A PR that fails its own package's test suite can't be reviewed on its merits, so please verify locally before opening.

@Kohei-Wada Kohei-Wada closed this Jul 27, 2026
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.

3 participants