You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(cli): campus.audit error messages drop the HTTP status when the response carries no description #60
The campus audit group (#55) maps failures onto human messages in campus_cli/audit/client.py. api_error_details reads the status code
and the server's error_description, falling back to the exception text.
campus_python raises errors.APIError for every non-2xx response, and
when the response body is not JSON (a proxy's HTML 502, an empty body, a
404 page from a misconfigured deployment) the error carries no
description: error_description is None and str(e) is empty. The CLI
then prints a sentence with nothing in it, and drops the status code it
already knows:
✗ Failed to list API keys: .
The same empty case shows up in the login warning:
⚠ Could not verify the key against the audit service (); storing it unverified.
For an operator debugging a deployment, the status code is the single most
useful piece of information, and it is right there.
Proposed fix
When the failure carries no description, fall back to the status code
(HTTP 502) rather than an empty string. The status is already extracted
by api_error_details; it just needs to reach the message.
The related 422 case — the server's field-level errors array
({"field": "scopes", "code": "EMPTY", "message": …}) is dropped, so a
rejected keys new reports only "One or more fields are invalid" without
saying which field was rejected — is worth handling in the same pass: campus_python parses that array into APIError.errors.
Acceptance
A failed audit call whose response carries no description reports the
HTTP status (e.g. "HTTP 502") instead of an empty message.
The login verification warning names the status too.
A 422 response lists the offending fields (field, code, message).
Fixed by 0982193, merged to main via PR #55 (campus.audit command group, #54). Verified: full suite green (293 tests, Python 3.11–3.14 CI), ruff clean.
Activity
fix(cli): campus.audit review follow-ups — error detail, JSON shapes,…
ngjunsiang commentedon Oct 20, 2026
Fixed by 0982193, merged to main via PR #55 (campus.audit command group, #54). Verified: full suite green (293 tests, Python 3.11–3.14 CI), ruff clean.