From 350218f4f845942e3ef086653f84819a87e64928 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 11 Mar 2014 13:38:06 +0400 Subject: [PATCH] quickAddFeed: gracefully handle backend timeout/JSON parse problems --- js/functions.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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']; -- 2.39.5