Skip to content

Replace raw HTTP error leakage with user-friendly messages#68

Merged
George-iam merged 2 commits intomainfrom
feat/error-ux-hardening-20260324
Mar 24, 2026
Merged

Replace raw HTTP error leakage with user-friendly messages#68
George-iam merged 2 commits intomainfrom
feat/error-ux-hardening-20260324

Conversation

@George-iam
Copy link
Contributor

Summary

  • Replace 8 sites that exposed raw HTTP response bodies (e.g. "personal context returned 401: {\"error\":{...}}") with httpErrorMessage() which provides actionable messages
  • Fix printResult to show user-friendly errors instead of dumping raw JSON body for error responses in non-JSON mode
  • Clarify --bearer-token help text as alias for --actor-token

Sites fixed

  • newStatusCmd (gateway health)
  • personalContextFromServer (whoami/context)
  • personalWorkspaceSelectionAPIError (workspace selection)
  • enterpriseMembersAPIError (member operations)
  • serviceAccountsAPIError (service account operations)
  • listAccountSessions (session list)
  • revokeAccountSessionByID (session revoke)
  • logoutAll (logout-all)

Test plan

  • go build ./... compiles
  • go test ./... passes
  • Run error scenarios against staging (missing auth, wrong key, expired token, 404, 429)
  • Verify no raw JSON/HTTP bodies in error output

- Replace 8 sites that exposed raw HTTP response bodies to users with
  httpErrorMessage() which translates status codes to actionable messages
  (401→"Run axme login", 403→"Permission denied", 429→quota details, etc.)
- Fix printResult to show user-friendly errors instead of dumping raw JSON
  in non-JSON mode for error responses (status >= 400)
- Clarify --bearer-token help text as alias for --actor-token

All tests pass.
Detail field in error responses can be either a string or an array
of validation error objects. Parse both formats to extract user-friendly
message instead of showing "Request failed (422)." with no context.

Before: "Request failed (422)."
After:  "Request failed (422): Input should be a valid UUID, ..."
@George-iam George-iam merged commit 94ffbab into main Mar 24, 2026
1 check passed
@George-iam George-iam deleted the feat/error-ux-hardening-20260324 branch March 24, 2026 10:50
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.

1 participant