From: Andrew Dolgov Date: Thu, 20 Oct 2011 08:34:22 +0000 (+0400) Subject: better error logging for invalid JSON data in headlines and article callbacks X-Git-Tag: 1.5.6~3 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=b74fa65f6dffb3cc244482dcd3f902419781e9d0;p=tt-rss.git better error logging for invalid JSON data in headlines and article callbacks --- diff --git a/viewfeed.js b/viewfeed.js index c5a896aa..be2c5c67 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -154,9 +154,10 @@ function headlines_callback2(transport, offset, background) { request_counters(); } else { - console.warn("headlines_callback: returned no XML object"); + console.error("Invalid object received: " + transport.responseText); dijit.byId("headlines-frame").attr('content', "
" + - __('Could not update headlines (invalid object received)') + "
"); + __('Could not update headlines (invalid object received - see error console for details)') + + ""); } _infscroll_request_sent = 0; @@ -246,7 +247,13 @@ function article_callback2(transport, id) { handle_rpc_json(transport); - var reply = JSON.parse(transport.responseText); + var reply = false; + + try { + reply = JSON.parse(transport.responseText); + } catch (e) { + console.error(e); + } if (reply) { @@ -269,10 +276,10 @@ function article_callback2(transport, id) { // } } else { - console.warn("article_callback: returned invalid data"); + console.error("Invalid object received: " + transport.responseText); render_article("
" + - __('Could not display article (invalid data received)') + "
"); + __('Could not display article (invalid object received - see error console for details)') + ""); } request_counters();