exception handling in some code blocks

master
Andrew Dolgov 19 years ago
parent d6bf9d4192
commit 7719618b29

@ -1,10 +1,9 @@
function viewfeed(feed, skip, subop, doc) {
try {
if (!doc) doc = parent.document;
// p_notify("Loading headlines...");
enableHotkeys();
var searchbox = doc.getElementById("searchbox");
@ -98,7 +97,9 @@ function viewfeed(feed, skip, subop, doc) {
} */
// notify("");
} catch (e) {
exception_error("viewfeed", e);
}
}
function localHotkeyHandler(keycode) {

@ -1,5 +1,10 @@
var hotkeys_enabled = true;
function exception_error(location, e) {
alert("Exception: " + e.name + "\nMessage: " + e.message +
"\nLocation: " + location);
}
function disableHotkeys() {
hotkeys_enabled = false;
}
@ -330,7 +335,7 @@ if (!xmlhttp_rpc && typeof XMLHttpRequest!='undefined') {
function all_counters_callback() {
if (xmlhttp_rpc.readyState == 4) {
try {
if (!xmlhttp_rpc.responseXML) {
notify("[all_counters_callback] backend did not return valid XML");
return;
@ -373,6 +378,9 @@ function all_counters_callback() {
}
}
}
} catch (e) {
exception_error("all_counters_callback", e);
}
}
}
@ -506,4 +514,3 @@ function getSelectedTableRowIds(content_id, prefix) {
}

@ -28,8 +28,8 @@ if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
}
function feedlist_callback() {
var container = document.getElementById('prefContent');
if (xmlhttp.readyState == 4) {
var container = document.getElementById('prefContent');
container.innerHTML=xmlhttp.responseText;
if (active_feed) {
var row = document.getElementById("FEEDR-" + active_feed);
@ -1146,8 +1146,9 @@ function selectTab(id) {
function init() {
// IE kludge
try {
// IE kludge
if (!xmlhttp) {
document.getElementById("prefContent").innerHTML =
"<b>Fatal error:</b> This program needs XmlHttpRequest " +
@ -1159,32 +1160,11 @@ function init() {
document.onkeydown = hotkey_handler;
notify("");
} catch (e) {
exception_error("init", e);
}
/*
var help_topic_id = false;
function do_dispOptionHelp() {
if (!xmlhttp_ready(xmlhttp))
return;
xmlhttp.open("GET", "backend.php?op=pref-prefs&subop=getHelp&pn=" +
param_escape(help_topic_id), true);
xmlhttp.onreadystatechange=gethelp_callback;
xmlhttp.send(null);
}
function dispOptionHelp(event, sender) {
help_topic_id = sender.id;
// document.setTimeout("do_dispOptionHelp()", 100);
} */
function closeInfoBox() {
var box = document.getElementById('infoBox');
var shadow = document.getElementById('infoBoxShadow');

@ -386,13 +386,10 @@ a.button {
font-weight : bold;
}
.evenSelected {
.evenSelected, .oddSelected {
background-color : #e0e0ff;
}
.oddSelected {
background-color : #e0e0ff;
}
/*
.feedUnreadSelected, .feedSelectedUnread,

@ -62,8 +62,7 @@ function dialog_refresh_callback() {
function refetch_callback() {
if (xmlhttp.readyState == 4) {
// document.title = "Tiny Tiny RSS";
try {
if (!xmlhttp.responseXML) {
notify("refetch_callback: backend did not return valid XML");
@ -118,7 +117,9 @@ function refetch_callback() {
updateTitle("");
notify("All feeds updated.");
} catch (e) {
exception_error("refetch_callback", e);
}
}
}
@ -126,6 +127,8 @@ function backend_sanity_check_callback() {
if (xmlhttp.readyState == 4) {
try {
if (!xmlhttp.responseXML) {
fatalError(3);
return;
@ -145,24 +148,12 @@ function backend_sanity_check_callback() {
}
init_second_stage();
}
}
/* wtf this is obsolete
function updateFeed(feed_id) {
var query_str = "backend.php?op=rpc&subop=updateFeed&feed=" + feed_id;
if (xmlhttp_ready(xmlhttp)) {
xmlhttp.open("GET", query_str, true);
xmlhttp.onreadystatechange=feed_update_callback;
xmlhttp.send(null);
} else {
printLockingError();
} catch (e) {
exception_error("backend_sanity_check_callback", e);
}
}
}
*/
function scheduleFeedUpdate(force) {
@ -343,28 +334,13 @@ function genericSanityCheck() {
fatalError(2);
}
/* if (!xmlhttp) {
document.getElementById("headlines").innerHTML =
"<b>Fatal error:</b> This program requires XmlHttpRequest " +
"to function properly. Your browser doesn't seem to support it.";
return false;
}
setCookie("ttrss_vf_test", "TEST");
if (getCookie("ttrss_vf_test") != "TEST") {
document.getElementById("headlines").innerHTML =
"<b>Fatal error:</b> This program requires cookies " +
"to function properly. Your browser doesn't seem to support them.";
return false;
} */
return true;
}
function init() {
try {
disableContainerChildren("headlinesToolbar", true);
if (!genericSanityCheck())
@ -374,10 +350,15 @@ function init() {
xmlhttp.onreadystatechange=backend_sanity_check_callback;
xmlhttp.send(null);
} catch (e) {
exception_error("init", e);
}
}
function init_second_stage() {
try {
setCookie("ttrss_vf_actfeed", "");
updateFeedList(false, false);
@ -407,7 +388,9 @@ function init_second_stage() {
if (splash) {
splash.style.display = "none";
}
} catch (e) {
exception_error("init_second_stage", e);
}
}
function quickMenuGo() {

Loading…
Cancel
Save