Closed adamkchew closed 6 years ago
We've encountered the same problem today. Server responded with HTTP 503 and HTML page instead of JSON. We had to hack the library code to find this out.
Yeah me too, same problem today. the try catch provided by @adamkchew will help
@zdila this error was corrected in current version (1.2.3). Maybe you are using an outdated version.
@ziedmahdi Thanks for info. In production we unfortunately use 1.2.2.
I'm able to make API call's to the api but when there is a error response, it's not in a JSON format. Could we update the API to return in a JSON error format?
The exception isn't helpful as I don't know the reason for the error in the first place.
var api_request = new RSVP.Promise(function(fulfill, reject) { request(request_options, function(error, response, body) { try { JSON.parse(body); } catch (e) { reject("Not a valid JSON object.") return; }