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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -85,7 +85,14 @@ function apiCall(method, path, params, cb) {
return cb({ error: "Query timeout after " + timeout + "s" }); 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);
} }
}); });
} }