-
-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Give better error when receiving non-JSON response #1404
Conversation
Without this, if the server returns an NGINX error page, `defaultFetch` will still attempt to parse the response as JSON, which will throw a syntax error, which is harder to understand than something like `502: Bad Gateway`
🦋 Changeset detectedLatest commit: 398f4f2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for houdini-docs-next canceled.
|
✅ Deploy Preview for houdinigraphql canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it could be useful if the error also contained something like "failed to fetch: server returned invalid response" or so, to be a bit more clear as to what went wrong.
Okay, the error message has been updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for adding this in!
Fixes # N/A : https://discord.com/channels/1024421016405016718/1301635915663278131
To help everyone out, please make sure your PR does the following:
pnpm run tests
andcd integration && pnpm run tests
pnpm changeset
Without this, if the server returns a non-JSON error response such as an NGINX error page,
defaultFetch
will still attempt to parse the response as JSON, which will throw a syntax error. Instead, this PR changes it to throw the semantic HTTP error which is easier to understand than a SyntaxError from parsing HTML as JSON.