use try/catch block in updatefeedlist

remove reporting function from exception dialog
This commit is contained in:
Andrew Dolgov 2017-03-05 10:30:49 +03:00
parent 1bfe1d7b31
commit e0a957b3f6
3 changed files with 70 additions and 97 deletions

View File

@ -817,8 +817,8 @@ div.fatalError button {
} }
div.fatalError textarea { div.fatalError textarea {
width : 100%; width : 565px;
height : 100px; height : 200px;
} }
#ttrssMain #main { #ttrssMain #main {

View File

@ -55,34 +55,19 @@ function exception_error(e, e_compat) {
var msg = e.toString(); var msg = e.toString();
msg += "<p>"+ __("The error will be reported to the configured log destination.") +
"</p>";
console.error(msg); console.error(msg);
var content = "<div class=\"fatalError\">" + var content = "<div class='fatalError'><p>" + msg + "</p>";
"<pre>" + msg + "</pre>";
content += "<form name=\"exceptionForm\" id=\"exceptionForm\" target=\"_blank\" "+ if (e.stack) {
"action=\"https://tt-rss.org/report.php\" method=\"POST\">";
content += "<textarea style=\"display : none\" name=\"message\">" + msg + "</textarea>";
content += "<textarea style=\"display : none\" name=\"params\">N/A</textarea>";
if (e) {
content += "<div><b>Stack trace:</b></div>" + content += "<div><b>Stack trace:</b></div>" +
"<textarea name=\"stack\" readonly=\"1\">" + e.stack + "</textarea>"; "<textarea name=\"stack\" readonly=\"1\">" + e.stack + "</textarea>";
} }
content += "</form>";
content += "</div>"; content += "</div>";
content += "<div class='dlgButtons'>"; content += "<div class='dlgButtons'>";
content += "<button dojoType=\"dijit.form.Button\""+
"onclick=\"dijit.byId('exceptionDlg').report()\">" +
__('Report to tt-rss.org') + "</button> ";
content += "<button dojoType=\"dijit.form.Button\" "+ content += "<button dojoType=\"dijit.form.Button\" "+
"onclick=\"dijit.byId('exceptionDlg').hide()\">" + "onclick=\"dijit.byId('exceptionDlg').hide()\">" +
__('Close') + "</button>"; __('Close') + "</button>";
@ -95,22 +80,6 @@ function exception_error(e, e_compat) {
id: "exceptionDlg", id: "exceptionDlg",
title: "Unhandled exception", title: "Unhandled exception",
style: "width: 600px", style: "width: 600px",
report: function() {
if (confirm(__("Are you sure to report this exception to tt-rss.org? The report will include information about your web browser and tt-rss configuration. Your IP will be saved in the database."))) {
document.forms['exceptionForm'].params.value = $H({
browserName: navigator.appName,
browserVersion: navigator.appVersion,
browserPlatform: navigator.platform,
browserCookies: navigator.cookieEnabled,
ttrssVersion: __ttrss_version,
initParams: JSON.stringify(init_params),
}).toQueryString();
document.forms['exceptionForm'].submit();
}
},
content: content}); content: content});
dialog.show(); dialog.show();

View File

@ -41,7 +41,7 @@ function setActiveFeedId(id, is_cat) {
function updateFeedList() { function updateFeedList() {
try {
Element.show("feedlistLoading"); Element.show("feedlistLoading");
resetCounterCache(); resetCounterCache();
@ -51,7 +51,8 @@ function updateFeedList() {
} }
var store = new dojo.data.ItemFileWriteStore({ var store = new dojo.data.ItemFileWriteStore({
url: "backend.php?op=pref_feeds&method=getfeedtree&mode=2"}); url: "backend.php?op=pref_feeds&method=getfeedtree&mode=2"
});
var treeModel = new fox.FeedStoreModel({ var treeModel = new fox.FeedStoreModel({
store: store, store: store,
@ -68,7 +69,7 @@ function updateFeedList() {
onClick: function (item, node) { onClick: function (item, node) {
var id = String(item.id); var id = String(item.id);
var is_cat = id.match("^CAT:"); var is_cat = id.match("^CAT:");
var feed = id.substr(id.indexOf(":")+1); var feed = id.substr(id.indexOf(":") + 1);
viewfeed({feed: feed, is_cat: is_cat}); viewfeed({feed: feed, is_cat: is_cat});
return false; return false;
}, },
@ -78,13 +79,13 @@ function updateFeedList() {
id: "feedTree", id: "feedTree",
}, "feedTree"); }, "feedTree");
/* var menu = new dijit.Menu({id: 'feedMenu'}); /* var menu = new dijit.Menu({id: 'feedMenu'});
menu.addChild(new dijit.MenuItem({ menu.addChild(new dijit.MenuItem({
label: "Simple menu item" label: "Simple menu item"
})); }));
// menu.bindDomNode(tree.domNode); */ // menu.bindDomNode(tree.domNode); */
var tmph = dojo.connect(dijit.byId('feedMenu'), '_openMyself', function (event) { var tmph = dojo.connect(dijit.byId('feedMenu'), '_openMyself', function (event) {
console.log(dijit.getEnclosingWidget(event.target)); console.log(dijit.getEnclosingWidget(event.target));
@ -93,7 +94,7 @@ function updateFeedList() {
$("feeds-holder").appendChild(tree.domNode); $("feeds-holder").appendChild(tree.domNode);
var tmph = dojo.connect(tree, 'onLoad', function() { var tmph = dojo.connect(tree, 'onLoad', function () {
dojo.disconnect(tmph); dojo.disconnect(tmph);
Element.hide("feedlistLoading"); Element.hide("feedlistLoading");
@ -107,6 +108,9 @@ function updateFeedList() {
}); });
tree.startup(); tree.startup();
} catch (e) {
exception_error(e);
}
} }
function catchupAllFeeds() { function catchupAllFeeds() {