check for error before looking at response

Occasionally an error will occur on the requests so we need to check for an error as well as the 200 in the response.  If we don't check for the error you can get a "cannot read statusCode of undefined" error and the app crashes.