function report_error(message, filename, lineno, colno, error) {
- exception_error(error);
+ exception_error(error, null, filename, lineno);
}
-function exception_error(e, e_compat) {
+function exception_error(e, e_compat, filename, lineno, colno) {
if (typeof e == "string") e = e_compat;
if (!e) return; // no exception object, nothing to report.
try {
+ console.error(e);
+ var msg = e.toString();
try {
new Ajax.Request("backend.php", {
- parameters: {op: "rpc", method: "log", logmsg: msg},
+ parameters: {op: "rpc", method: "log",
+ file: e.fileName ? e.fileName : filename,
+ line: e.lineNumber ? e.lineNumber : lineno,
+ msg: msg, context: e.stack},
onComplete: function (transport) {
- console.log(transport.responseText);
+ console.warn(transport.responseText);
} });
} catch (e) {
console.error("Exception while trying to log the error.", e);
}
- var msg = e.toString();
-
- msg += "<p>"+ __("The error will be reported to the configured log destination.") +
- "</p>";
-
- console.error(msg);
-
- var content = "<div class=\"fatalError\">" +
- "<pre>" + msg + "</pre>";
-
- content += "<form name=\"exceptionForm\" id=\"exceptionForm\" target=\"_blank\" "+
- "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>";
+ var content = "<div class='fatalError'><p>" + msg + "</p>";
- if (e) {
+ if (e.stack) {
content += "<div><b>Stack trace:</b></div>" +
"<textarea name=\"stack\" readonly=\"1\">" + e.stack + "</textarea>";
}
- content += "</form>";
-
content += "</div>";
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\" "+
"onclick=\"dijit.byId('exceptionDlg').hide()\">" +
__('Close') + "</button>";
id: "exceptionDlg",
title: "Unhandled exception",
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});
dialog.show();
var feed_id = activeFeedIsCat() ? 'CAT:' + parseInt(getActiveFeedId()) :
getActiveFeedId();
- var rule = { reg_exp: selectedText, feed_id: feed_id, filter_type: 1 };
+ var rule = { reg_exp: selectedText, feed_id: [feed_id], filter_type: 1 };
addFilterRule(null, dojo.toJson(rule));
var feed_id = activeFeedIsCat() ? 'CAT:' + parseInt(getActiveFeedId()) :
getActiveFeedId();
- var rule = { reg_exp: title, feed_id: feed_id, filter_type: 1 };
+ var rule = { reg_exp: title, feed_id: [feed_id], filter_type: 1 };
addFilterRule(null, dojo.toJson(rule));
}
}
-function resetPubSub(feed_id, title) {
-
- var msg = __("Reset subscription? Tiny Tiny RSS will try to subscribe to the notification hub again on next feed update.").replace("%s", title);
-
- if (title == undefined || confirm(msg)) {
- notify_progress("Loading, please wait...");
-
- var query = "?op=pref-feeds&quiet=1&method=resetPubSub&ids=" + feed_id;
-
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function(transport) {
- dijit.byId("pubsubReset_Btn").attr('disabled', true);
- notify_info("Subscription reset.");
- } });
- }
-
- return false;
-}
-
-
function unsubscribeFeed(feed_id, title) {
var msg = __("Unsubscribe from %s?").replace("%s", title);