fix: handle non-json 200 responses#142
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughHttpClient now converts JSON-parsing failures on successful (200 OK) responses into a standardized ApiError via a new nonJsonSuccessResponseError helper, providing UNAVAILABLE error code, diagnostic details, and next-action guidance. A corresponding test validates this error mapping and debug event sequencing. ChangesNon-JSON Success Response Handling
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant HttpClient
participant Server
Caller->>HttpClient: get()/requestWithMeta()
HttpClient->>Server: fetch request
Server-->>HttpClient: 200 response, content-type text/html
HttpClient->>HttpClient: response.json() fails
HttpClient->>HttpClient: nonJsonSuccessResponseError(response, requestId)
HttpClient-->>Caller: throw ApiError (UNAVAILABLE)
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
please close this @zeshi-du , I have the issue assigned to me and I opened the issue first |
|
Closing in favor of #166, which landed today covering the same gap (200-with-non-JSON-body → typed error instead of a raw SyntaxError). The taxonomy call went to |
Refs #94
Discord: npall_805
Summary:
Validation:
Summary by CodeRabbit
client.get()now reports a clearer API error instead of exposing a raw parsing failure.