Skip to content

fix: reject on non-2xx HTTP responses in API service (\ bounty #1) - #27

Open
zhuyh1606-oss wants to merge 1 commit into
2lll5:mainfrom
zhuyh1606-oss:main
Open

fix: reject on non-2xx HTTP responses in API service (\ bounty #1)#27
zhuyh1606-oss wants to merge 1 commit into
2lll5:mainfrom
zhuyh1606-oss:main

Conversation

@zhuyh1606-oss

Copy link
Copy Markdown

Summary

Make the shared frontend API service properly reject non-2xx HTTP responses instead of returning them as successful ApiResponse<T>.

Changes

  • api.ts: Added parseErrorResponse() helper. request() now throws ApiError on non-2xx status through error interceptors.
  • API_VALIDATION.md: Documented all error scenarios with expected behavior.

Testing

  • npm run build passes clean
  • Diagnostic build log committed

- request<T>() now throws ApiError on non-2xx status instead of
  returning as successful ApiResponse<T>
- parseErrorResponse extracts JSON/text error bodies into ApiError
  with code, message, details, requestId, and path
- Error interceptors run for normalized HTTP errors (401, 429)
- Timeout and network-error behavior preserved
- Added API_VALIDATION.md documenting all error scenarios
@zhuyh1606-oss

Copy link
Copy Markdown
Author

Hi maintainers, gentle bump on this PR. It adds proper error handling for non-2xx HTTP responses in the API service. Mergeable and ready for review whenever you have time. Thanks!

@zhuyh1606-oss

Copy link
Copy Markdown
Author

Hi @2lll5, just following up on this PR. It's been open for a while and is ready for merge. Could you please review and merge when you have time? Thanks!

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