Skip to content

[TypeScript] Harden API response error handling#9

Open
cwjcwj95 wants to merge 1 commit into
2lll5:mainfrom
cwjcwj95:harden-api-errors
Open

[TypeScript] Harden API response error handling#9
cwjcwj95 wants to merge 1 commit into
2lll5:mainfrom
cwjcwj95:harden-api-errors

Conversation

@cwjcwj95

Copy link
Copy Markdown

This PR hardens the API response error handling in :

Problems fixed:

  1. Non-2xx HTTP responses (4xx/5xx) were parsed as successful data
  2. Error interceptors for 401/429 were never reliably exercised because HTTP errors never reached them
  3. Callers had to duplicate status checks
  4. Structured error payload details were lost

Changes:

  • now checks and throws for non-2xx status codes
  • Error payloads are preserved with helper
  • User-friendly suggestions added via for common status codes
  • Response interceptors now only receive successful responses
  • Error interceptors reliably handle 401 (auth refresh trigger) and 429 (rate limit)
  • Added dispatch on 401 for UI login redirect

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