Skip to content

fix: clean up HTTP error messages for CLI commands#20

Closed
NikolayS wants to merge 1 commit into
mainfrom
claude/fix-502-error-handling-ci0kd
Closed

fix: clean up HTTP error messages for CLI commands#20
NikolayS wants to merge 1 commit into
mainfrom
claude/fix-502-error-handling-ci0kd

Conversation

@NikolayS
Copy link
Copy Markdown
Contributor

@NikolayS NikolayS commented Dec 26, 2025

The new formatHttpError() utility:

  • Maps common HTTP status codes (400, 401, 403, 404, 408, 429, 500, 502, 503, 504) to human-readable messages
  • Detects and suppresses HTML content (Cloudflare error pages, etc.)
  • Extracts message/error/detail fields from JSON error responses
  • Truncates overly long plain text responses (>500 chars)

Test plan

  • Verify build passes: bun run build
  • Test with valid API key: postgresai issues list
  • Test with invalid API key to verify 401 message formatting
  • Simulate 502 error to verify HTML is not dumped

https://gitlab.com/postgres-ai/platform/-/issues/346

Replace raw HTML error pages (e.g., Cloudflare 502) with developer-friendly
messages showing HTTP status code and human-readable description.
@NikolayS NikolayS closed this Dec 26, 2025
@NikolayS NikolayS deleted the claude/fix-502-error-handling-ci0kd branch December 26, 2025 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants