From: Andrew Dolgov Date: Wed, 14 Dec 2005 07:29:38 +0000 (+0100) Subject: misc exception handling improvements X-Git-Tag: schema_freeze_for_1.1.1~41 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=83f043bb941b40ba0e5c6b29d01776e92db5936c;p=tt-rss.git misc exception handling improvements --- diff --git a/feedlist.js b/feedlist.js index ead7948a..e9310837 100644 --- a/feedlist.js +++ b/feedlist.js @@ -181,7 +181,7 @@ function toggleCollapseCat(cat) { xmlhttp_rpc.send(null); } catch (e) { - exception_error(e); + exception_error("toggleCollapseCat", e); } } diff --git a/functions.js b/functions.js index f82708b2..53cee530 100644 --- a/functions.js +++ b/functions.js @@ -1,8 +1,19 @@ var hotkeys_enabled = true; function exception_error(location, e) { - alert("Exception: " + e.name + "\nMessage: " + e.message + - "\nLocation: " + location); + var msg; + + 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() { @@ -133,7 +144,7 @@ function hotkey_handler(e) { try { localHotkeyHandler(keycode); } catch (e) { - exception_error(e); + exception_error("hotkey_handler", e); } } @@ -395,7 +406,7 @@ function parse_counters(reply, f_document) { } } } catch (e) { - exception_error(e); + exception_error("parse_counters", e); } } diff --git a/viewfeed.js b/viewfeed.js index 7047aaae..1d2c894c 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -268,7 +268,7 @@ function selectionToggleUnread(cdm_mode) { } } catch (e) { - exception_error(e); + exception_error("selectionToggleUnread", e); } } @@ -320,7 +320,7 @@ function selectionToggleMarked(cdm_mode) { } } catch (e) { - exception_error(e); + exception_error("selectionToggleMarked", e); } }