[request] Clearer error message for JSON deserialization failure (#2195)

This commit is contained in:
Martti Laine 2018-08-06 13:35:50 +02:00 committed by Pierre-Yves Gérardy
parent e46d03f467
commit fd7cf8041e
3 changed files with 3 additions and 2 deletions

View file

@ -162,7 +162,7 @@ module.exports = function($window, Promise) {
function deserialize(data) {
try {return data !== "" ? JSON.parse(data) : null}
catch (e) {throw new Error(data)}
catch (e) {throw new Error("Invalid JSON: " + data)}
}
function extract(xhr) {return xhr.responseText}