Skip to content
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

improvement: use clear error if Git Gateway off #1695

Merged
merged 2 commits into from
Sep 4, 2018

Conversation

tech4him1
Copy link
Contributor

Summary

If Git Gateway is disabled, the current error is very unclear: Unexpected token < in JSON at position 0. This PR changes to Git Gateway initial settings check code to validate that the request is OK (200 code) and is actually JSON. If not, we output a clear error message.

Test plan

A picture of a cute animal (not mandatory but encouraged)

@tech4him1
Copy link
Contributor Author

@tomrutgers Would you mind reviewing the error messages here?

@verythorough
Copy link
Contributor

verythorough commented Aug 30, 2018

Deploy preview for netlify-cms-www ready!

Built with commit 6b10642

https://deploy-preview-1695--netlify-cms-www.netlify.com

Copy link
Contributor

@tomrutgers tomrutgers left a comment

Choose a reason for hiding this comment

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

LGTM @tech4him1

@erquhart
Copy link
Contributor

@tech4him1 linting error:

10:34:03 PM: /opt/build/repo/packages/netlify-cms-backend-git-gateway/src/implementation.js
10:34:03 PM:    96:23  error  'APIError' is not defined  no-undef
10:34:03 PM:   106:23  error  'APIError' is not defined  no-undef
10:34:03 PM: ✖ 2 problems (2 errors, 0 warnings)

@verythorough
Copy link
Contributor

Deploy preview for cms-demo ready!

Built with commit 6b10642

https://deploy-preview-1695--cms-demo.netlify.com

@erquhart
Copy link
Contributor

erquhart commented Sep 4, 2018

Good change @tech4him1. It also occurs to me that we're trusting backends to send valid json instead of testing it, but we can make that improvement outside of this.

@erquhart erquhart merged commit 62b2f9c into decaporg:master Sep 4, 2018
@tech4him1 tech4him1 deleted the fix-git-gateway-disabled-err branch September 4, 2018 16:05
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.

4 participants