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

fix(FEC-8316): protect against invalid server response #57

Merged
merged 1 commit into from
Jun 17, 2018
Merged

Conversation

OrenMe
Copy link
Contributor

@OrenMe OrenMe commented Jun 13, 2018

Description of the Changes

Add handling for invalid server response, as we assume that the response is always a valid JSON response

CheckLists

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (whenever applicable)
  • test are passing in local environment
  • Travis tests are passing (or test results are not worse than on master branch :))
  • Docs have been updated

try {
jsonResponse = JSON.parse(request.responseText);
} catch (e) {
return reject(`${e.message}, ${request.responseText}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just reject no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the reject is to not proceed to rest of code.

@OrenMe OrenMe merged commit de5d5e3 into master Jun 17, 2018
@OrenMe OrenMe deleted the FEC-8316 branch June 17, 2018 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants