Skip to content

fix(frontend): normalize non-2xx API responses into ApiError (#1) - #21

Open
yanyishuai wants to merge 1 commit into
2lll5:mainfrom
yanyishuai:bounty/issue-1-api-error-handling
Open

fix(frontend): normalize non-2xx API responses into ApiError (#1)#21
yanyishuai wants to merge 1 commit into
2lll5:mainfrom
yanyishuai:bounty/issue-1-api-error-handling

Conversation

@yanyishuai

Copy link
Copy Markdown

Summary

Hardens the shared frontend API client so non-OK HTTP responses are normalized into ApiError objects, run through the existing error interceptor chain, and thrown consistently instead of being returned as successful ApiResponse<T> values.

Changes

  • frontend/src/services/api.ts — reject on non-2xx, map JSON/text error payloads, preserve request IDs and paths
  • frontend/src/services/api.test.ts — vitest coverage for 200/401/429/500/timeout paths
  • frontend/package.json, frontend/vite.config.ts — wire vitest + jsdom test runner

Validation

cd frontend && npm test
python build.py -m compliance

Fixtures are hand-written fetch mocks (not parser-generated samples). Diagnostic build artifacts included per repo PR template.

Closes #1

Solana wallet for bounty payout: Do4v7foHJvRJLpRRoGaVPWX6DDEjX3yTK7J91gpwUQpE

@yanyishuai

Copy link
Copy Markdown
Author

External bounty ready for maintainer review — acceptance criteria documented in PR body. Happy to address feedback immediately.

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.

[$40 BOUNTY] [TypeScript] Harden API response error handling

1 participant