Skip to content

Conversation

@mkitti
Copy link
Contributor

@mkitti mkitti commented Jan 5, 2026

Resolve #283 in part by adding a test for error handling by
fileQueries.js.

When a 500 Internal Server Error was created, we would attempt to parse
the response content as JSON, resulting in another error:

Unexpected token 'I', "Internal S"... is not valid JSON

This pull request adds a new test to check for this kind of error message.

  • test: add reproduction case for frontend 500 error handling (expected fail)
  • test: refine reproduction test (rename and add assertion)

The test is expected to fail until #285 is merged.

Assisted by Gemini 3 Pro (Low) via Antigravity.

@mkitti mkitti changed the title Test fileQueries handling of a 500 Internal Server Error test: fileQueries handling of a 500 Internal Server Error Jan 6, 2026
// so we Assert what we WANT (the fix).
// This test definition asserts the correct behavior.
// Running it on the buggy branch should FAIL this assertion.
expect(error?.message).toBe('Server returned 500 Internal Server Error');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the likely next step here would be to remove or modify this line and keep the next line that checks for the abseence of 'Unexpected token'.

The main point of the test is to make sure that we are not showing JSON parsing errors of other error messages. We may not want to test for a specific error message.

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.

fileglancer attempts to parse the returned response contents as JSON despite a response code of 500.

2 participants