quickAddFeed: gracefully handle backend timeout/JSON parse problems

This commit is contained in:
Andrew Dolgov 2014-03-11 13:38:06 +04:00
parent 99c19e1dcb
commit 350218f4f8
1 changed files with 8 additions and 1 deletions

View File

@ -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'];