Skip to content

fix: check response.ok before parsing JSON in frontend fetch calls#49

Merged
gordonmurray merged 1 commit into
lance-format:mainfrom
gordonmurray:fix/27-response-ok-checks
Jun 10, 2026
Merged

fix: check response.ok before parsing JSON in frontend fetch calls#49
gordonmurray merged 1 commit into
lance-format:mainfrom
gordonmurray:fix/27-response-ok-checks

Conversation

@gordonmurray

@gordonmurray gordonmurray commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

All five fetch() calls in app.js called response.json() without checking the HTTP status, so a 4xx/5xx response got parsed as if it were real data and the UI broke in confusing ways further down. Each call now throws on !response.ok, which lands in the existing catch handlers and shows the normal error messages ("Failed to load data", "Connection Error", etc).

Corrupted datasets are not affected. The backend returns 200 with an informational row for those, and that still renders as before.

Also added a CHANGELOG entry under Unreleased.

Test plan

  • node --check web/vanilla/app.js
  • Stubbed fetch and the DOM in node and checked that a 500 from each endpoint shows the right error message, that the error body is never parsed, and that normal responses still render

Fixes #27

All five fetch() calls in app.js parsed the response body without
checking the HTTP status, so a 4xx/5xx error response was treated as
valid data and the UI broke further down. Throw on non-ok responses so
failures land in the existing catch handlers and show the normal error
messages.

Fixes lance-format#27
@gordonmurray gordonmurray force-pushed the fix/27-response-ok-checks branch from e558cee to 2a2048a Compare June 10, 2026 18:11
@gordonmurray gordonmurray merged commit 24aab0e into lance-format:main Jun 10, 2026
12 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.

fix: add response.ok checks to all frontend fetch calls

1 participant