diff --git a/static/js/app.js b/static/js/app.js index 1c5c5d7..e3a2b6a 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -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); } }); }