Skip to content

fix(frontend): harden API response error handling (closes #1)#20

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

fix(frontend): harden API response error handling (closes #1)#20
yanyishuai wants to merge 1 commit into
2lll5:mainfrom
yanyishuai:bounty/issue-1-error-handling-4851

Conversation

@yanyishuai

Copy link
Copy Markdown

Summary

Hardens parseResponse() to reject non-2xx HTTP responses as proper ApiError objects instead of silently returning malformed data.

Changes

  • parseResponse now checks response.ok and throws ApiError with status code, message, and a helpful suggestion
  • Added getSuggestionForStatus() helper for user-friendly error messages
  • Fixed error interceptor pipeline to preserve ApiError objects

Testing

  • Verified that 4xx/5xx responses now throw instead of returning empty data
  • All existing request interceptors remain compatible

Closes #1

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