DoSomething/ds-mdata-responder — pull request #261 by tongxiang (2014-10-23 22:04:31+00:00)
Title: sanitize donorsChoose response in try/catch block

#### What's this PR do?
This PR:

1) **moves API parsing logic into the try/catch block.**
A little hard to tell from the git diff, but this PR moves all the DonorsChoose.org API response manipulation logic (parsing it into JSON, pulling out a proposal that satisfies our criteria, and assigning variables to certain properties) into the try/catch block.

In the case that the API returns a proposal which has missing data, we're putting all our logic into the try/catch block so that any undefined variables won't throw an exception and crash the whole app.

2) **fixes the `selectedProposal` comparison logic so that it actually compares numbers, instead of strings (now we're including `parseInt()`**
3) **declares the `selectedProposal` variable outside of the loop, so that it's not re-created with each time the loop runs.**

#### Where should the reviewer start?
#### How should this be manually tested?
#### Any background context you want to provide?
#### What are the relevant tickets?
#### Questions: