Continue on parseJSON error (#708)

This commit is contained in:
dmahmalat
2024-03-12 01:03:37 -04:00
committed by GitHub
parent 8a8b9f07fb
commit 605c483d5b

View File

@@ -85,7 +85,14 @@ function apiCall(method, path, params, cb) {
return cb({ error: "Query timeout after " + timeout + "s" });
}
cb(jQuery.parseJSON(xhr.responseText));
var responseText;
try {
responseText = jQuery.parseJSON(xhr.responseText);
}
catch {
responseText = { error: "Failed to parse the JSON response." };
}
cb(responseText);
}
});
}