Fix debug output of thrown errors

At some point this switched to showing just the line on which the error
occurred.
This commit is contained in:
Dan Stillman 2012-01-11 18:45:22 -05:00
parent 662be5e198
commit da09a8dfcd

View file

@ -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);
}