Skip to content

feat: name the HTTP status when the error body is not JSON - #76

Merged
mogita merged 1 commit into
masterfrom
fix/cha-4641-error-status-in-message
Aug 12, 2026
Merged

feat: name the HTTP status when the error body is not JSON#76
mogita merged 1 commit into
masterfrom
fix/cha-4641-error-status-in-message

Conversation

@mogita

@mogita mogita commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Ticket

https://linear.app/stream/issue/CHA-4641/generated-sdks-report-the-http-status-when-the-error-body-is-not-json

Summary

When an error body is not JSON, the SDK reported only the parse failure and hid the HTTP status. A customer saw failed to parse error response for a 503 that the edge proxy returned as plain text, plus a JSON parse stack trace, and could not tell which status they got. ApiError#message now appends the status: failed to parse error response: unexpected server response code 503. status_code, raw_response_body and the cause do not change.

The old text is still the prefix of the new message, so prefix matching and substring matching on it both keep working.

Verification

  • make test: 305 examples, 0 failures.
  • make format-check, make lint, make security: clean.

An unparseable error body produced the message "failed to parse error
response", which hid the HTTP status. The message now appends the status
to that text, so prefix matching and substring matching both keep
working. The status code, the raw response body and the parse cause do
not change.
@mogita
mogita force-pushed the fix/cha-4641-error-status-in-message branch from 88c1e9f to 7b738f4 Compare August 12, 2026 18:01
@mogita mogita changed the title fix: name the HTTP status when the error body is not JSON feat: name the HTTP status when the error body is not JSON Aug 12, 2026
@mogita
mogita merged commit 0d973ba into master Aug 12, 2026
7 checks passed
@mogita
mogita deleted the fix/cha-4641-error-status-in-message branch August 12, 2026 18:49
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