commit da09a8dfcd53079153aa5bfaa5c8bfda953034d4 parent 662be5e1986720f538e0d20260cdde41e5bb6668 Author: Dan Stillman <dstillman@zotero.org> Date: Wed, 11 Jan 2012 18:45:22 -0500 Fix debug output of thrown errors At some point this switched to showing just the line on which the error occurred. Diffstat:
| M | chrome/content/zotero/xpcom/debug.js | | | 18 | +++++++++++++++++- |
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/chrome/content/zotero/xpcom/debug.js b/chrome/content/zotero/xpcom/debug.js @@ -46,7 +46,23 @@ Zotero.Debug = new function () { return; } - if (typeof message != 'string') { + // Properly display thrown Error objects + if (message && message.constructor) { + switch (message.constructor.name) { + case 'Error': + case 'EvalError': + case 'RangeError': + case 'ReferenceError': + case 'SyntaxError': + case 'TypeError': + case 'URIError': + message = "'message' => \"" + message.message + "\"\n" + + Zotero.Utilities.varDump(message) + "\n" + + message.stack; + break; + } + } + else if (typeof message != 'string') { message = Zotero.Utilities.varDump(message); }