Skip to content

fix(client): don't let non-JSON error bodies crash requests - #112

Merged
eyuapptree merged 2 commits into
masterfrom
eyu_458_list_upload_503
Aug 18, 2026
Merged

eyuapptree merged 2 commits into
masterfrom
eyu_458_list_upload_503

Conversation

@eyuapptree

Copy link
Copy Markdown
Contributor

Summary

  • FAMIS can return a 5xx with a plain-text body (e.g. "Service Unavailable" on a 503). Axios's default transformResponse could throw a raw SyntaxError trying to JSON.parse that body, which skipped throwResponseError entirely and surfaced an unhandled parse error instead of a clean ApiError with the real status.
  • The shared axios instance now parses defensively and falls back to the raw string, so throwResponseError/ApiError always get a real response to work with.
  • Bumped version to 1.4.1 and updated CHANGELOG.md.

Fixes apptreesoftware/facility360_r7#458

Test plan

  • Added and ran a regression test reproducing a 503 with a raw (non-pre-parsed) "Service Unavailable" string body via a custom axios adapter — confirmed it now rejects with ApiError (status 503) instead of a raw SyntaxError (test was removed afterward per request, since the fix is confirmed and covered manually)
  • Full suite: npm test — 11 suites / 113 tests passing
  • tsc --noEmit — clean

🤖 Generated with Claude Code

Eddie Yu and others added 2 commits August 14, 2026 10:10
FAMIS can return a 5xx with a plain-text body (e.g. "Service Unavailable"
on a 503). Axios's default transformResponse could throw a raw
SyntaxError trying to JSON.parse that body, which skipped
throwResponseError entirely and surfaced an unhandled parse error
instead of a clean ApiError with the real status. The shared axios
instance now parses defensively and falls back to the raw string.

Fixes #458

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@eyuapptree
eyuapptree requested a review from alphahlee August 14, 2026 02:18
@eyuapptree
eyuapptree merged commit e0ee727 into master Aug 18, 2026
2 checks passed
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.

2 participants