Try to log a better error for some instances of Zotero.debug(e);

This commit is contained in:
Dan Stillman 2016-05-03 13:47:37 -04:00
parent 72c8711cd3
commit 096ebb188b

View file

@ -1396,23 +1396,14 @@ Zotero.Utilities = {
//Special handling for Error or Exception
var isException = Zotero.isFx && !Zotero.isBookmarklet && obj instanceof Components.interfaces.nsIException;
var isError = obj instanceof Error;
if (!isException && !isError && constructor in obj && stack in obj) {
switch (obj.constructor.name) {
case 'Error':
case 'EvalError':
case 'RangeError':
case 'ReferenceError':
case 'SyntaxError':
case 'TypeError':
case 'URIError':
if (!isException && !isError && obj.message !== undefined && obj.stack !== undefined) {
isError = true;
}
}
if (isError || isException) {
var header = '';
if (isError) {
header = obj.constructor.name ? obj.constructor.name : 'Error';
header = (obj.constructor && obj.constructor.name) ? obj.constructor.name : 'Error';
} else {
header = (obj.name ? obj.name + ' ' : '') + 'Exception';
}