Skip to content

More Descriptive Error Message On Http 200 But No JSON#944

Merged
ssalinas merged 3 commits into
masterfrom
more-descriptive-error-on-http-200-no-json
Mar 17, 2016
Merged

More Descriptive Error Message On Http 200 But No JSON#944
ssalinas merged 3 commits into
masterfrom
more-descriptive-error-on-http-200-no-json

Conversation

@Calvinp

@Calvinp Calvinp commented Mar 11, 2016

Copy link
Copy Markdown
Contributor

When a user's session expires, we send an http 302 redirect to the login page. However, the browser catches this and follows it without passing it off to the application. Then the application receives html when it was expecting JSON. This handles that problem by advising the user of the situation and that one possible cause is an expired session.

Calvin Pomerantz and others added 2 commits March 11, 2016 16:36
Comment thread SingularityUI/app/application.coffee Outdated
Messenger().error
message: '''
<p>Expected JSON but received something else (possibly html). The response has been saved to your js console.</p>
<p>One possible cause is an http redirect to an html web page.</p>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I still think we can be a bit smarter about the messaging here. We can know if it is html by checking if the string starts with <!DOCTYPE html>. Then we can either say '...but received html' or '...but received something else' if we don't know.

Also, The one possible cause is very specific to our own use case. If there is no way for us to know that that might be the error, we shouldn't be mentioning possible causes.

…her than dumping the html on the screen as the error message
@ssalinas

Copy link
Copy Markdown
Contributor

LGTM

ssalinas added a commit that referenced this pull request Mar 17, 2016
…00-no-json

More Descriptive Error Message On Http 200 But No JSON
@ssalinas ssalinas merged commit d7cc7f4 into master Mar 17, 2016
@ssalinas ssalinas deleted the more-descriptive-error-on-http-200-no-json branch March 17, 2016 18:09
@ssalinas ssalinas modified the milestone: 0.4.12 Apr 1, 2016
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