From: Andrew Dolgov Date: Tue, 11 Mar 2014 09:38:06 +0000 (+0400) Subject: quickAddFeed: gracefully handle backend timeout/JSON parse problems X-Git-Tag: 1.12~20 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=350218f4f845942e3ef086653f84819a87e64928;p=tt-rss.git quickAddFeed: gracefully handle backend timeout/JSON parse problems --- diff --git a/js/functions.js b/js/functions.js index 43fae715..1ad15fcc 100644 --- a/js/functions.js +++ b/js/functions.js @@ -829,7 +829,14 @@ function quickAddFeed() { onComplete: function(transport) { try { - var reply = JSON.parse(transport.responseText); + try { + var reply = JSON.parse(transport.responseText); + } catch (e) { + Element.hide("feed_add_spinner"); + alert(__("Failed to parse output. This can indicate server timeout and/or network issues. Backend output was logged to browser console.")); + console.log('quickAddFeed, backend returned:' + transport.responseText); + return; + } var rc = reply['result'];