Dump stack on translation failure in newer versions of Firefox, where it appears to have ceased to be enumerable

This commit is contained in:
Simon Kornblith 2012-07-02 00:11:35 -04:00
parent e8ac371042
commit 6bed648eb2

View file

@ -1406,7 +1406,6 @@ Zotero.Translate.Base.prototype = {
Zotero.debug(string, level);
}
},
/**
* Generates a string from an exception
* @param {String|Exception} error
@ -1416,13 +1415,17 @@ Zotero.Translate.Base.prototype = {
if(typeof(error) == "string") {
errorString = "\nthrown exception => "+error;
} else {
var haveStack = false;
for(var i in error) {
if(typeof(error[i]) != "object") {
if(i === "stack") haveStack = true;
errorString += "\n"+i+' => '+error[i];
}
}
if(error) {
errorString += "\nstring => "+error.toString();
errorString += "\nstring => "+error.toString();
if(!haveStack && error.stack) {
// In case the stack is not enumerable
errorString += "\nstack => "+error.stack.toString();
}
}