Check HTTP response status codes in fetch() - #22
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces structured error handling for non-2xx HTTP responses in the NJTransit API client by defining an APIError struct and ErrUnexpectedStatus error, along with corresponding unit tests. The reviewer suggests falling back to http.StatusText when the error response body is empty to improve error message readability, and truncating the stored error body to prevent high memory usage and log pollution from large upstream error responses.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #22 +/- ##
==========================================
+ Coverage 84.24% 85.01% +0.76%
==========================================
Files 5 5
Lines 273 287 +14
==========================================
+ Hits 230 244 +14
Misses 26 26
Partials 17 17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Fixes #12, #18