misc exception handling improvements

This commit is contained in:
Andrew Dolgov 2005-12-14 08:29:38 +01:00
parent 672366bdf7
commit 83f043bb94
3 changed files with 18 additions and 7 deletions

View File

@ -181,7 +181,7 @@ function toggleCollapseCat(cat) {
xmlhttp_rpc.send(null); xmlhttp_rpc.send(null);
} catch (e) { } catch (e) {
exception_error(e); exception_error("toggleCollapseCat", e);
} }
} }

View File

@ -1,8 +1,19 @@
var hotkeys_enabled = true; var hotkeys_enabled = true;
function exception_error(location, e) { function exception_error(location, e) {
alert("Exception: " + e.name + "\nMessage: " + e.message + var msg;
"\nLocation: " + location);
if (e.fileName) {
var base_fname = e.fileName.substring(e.fileName.lastIndexOf("/") + 1);
msg = "Exception: " + e.name + ", " + e.message +
"\nFunction: " + location + "()" +
"\nLocation: " + base_fname + ":" + e.lineNumber;
} else {
msg = "Exception: " + e + "\nFunction: " + location + "()";
}
alert(msg);
} }
function disableHotkeys() { function disableHotkeys() {
@ -133,7 +144,7 @@ function hotkey_handler(e) {
try { try {
localHotkeyHandler(keycode); localHotkeyHandler(keycode);
} catch (e) { } catch (e) {
exception_error(e); exception_error("hotkey_handler", e);
} }
} }
@ -395,7 +406,7 @@ function parse_counters(reply, f_document) {
} }
} }
} catch (e) { } catch (e) {
exception_error(e); exception_error("parse_counters", e);
} }
} }

View File

@ -268,7 +268,7 @@ function selectionToggleUnread(cdm_mode) {
} }
} catch (e) { } catch (e) {
exception_error(e); exception_error("selectionToggleUnread", e);
} }
} }
@ -320,7 +320,7 @@ function selectionToggleMarked(cdm_mode) {
} }
} catch (e) { } catch (e) {
exception_error(e); exception_error("selectionToggleMarked", e);
} }
} }