]> git.wh0rd.org Git - tt-rss.git/commitdiff
quickAddFeed: gracefully handle backend timeout/JSON parse problems
authorAndrew Dolgov <noreply@fakecake.org>
Tue, 11 Mar 2014 09:38:06 +0000 (13:38 +0400)
committerAndrew Dolgov <noreply@fakecake.org>
Tue, 11 Mar 2014 09:38:06 +0000 (13:38 +0400)
js/functions.js

index 43fae715b633fb0e70db9a8cd01f10baaa13f8bf..1ad15fcc672a2d7c3c45bbdc9273f6d91f2ccdae 100644 (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'];