Simplify error logging in translator architecture
Hopefully the previous stuff is no longer necessary
This commit is contained in:
parent
542584eed3
commit
942b8b91f3
1 changed files with 14 additions and 22 deletions
|
@ -1929,29 +1929,21 @@ Zotero.Translate.Base.prototype = {
|
||||||
* Generates a string from an exception
|
* Generates a string from an exception
|
||||||
* @param {String|Exception} error
|
* @param {String|Exception} error
|
||||||
*/
|
*/
|
||||||
"_generateErrorString":function(error) {
|
_generateErrorString: function (error) {
|
||||||
var errorString = "";
|
var errorString = error;
|
||||||
if(typeof(error) == "string") {
|
if (error.stack && error) {
|
||||||
errorString = "\nthrown exception => "+error;
|
errorString += "\n\n" + error.stack;
|
||||||
} else {
|
|
||||||
var haveStack = false;
|
|
||||||
for(var i in error) {
|
|
||||||
if(typeof(error[i]) != "object") {
|
|
||||||
if(i === "stack") haveStack = true;
|
|
||||||
errorString += "\n"+i+' => '+error[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
errorString += "\nstring => "+error.toString();
|
|
||||||
if(!haveStack && error.stack) {
|
|
||||||
// In case the stack is not enumerable
|
|
||||||
errorString += "\nstack => "+error.stack.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (this.path) {
|
||||||
errorString += "\nurl => "+this.path
|
errorString += `\nurl => ${this.path}`;
|
||||||
+ "\ndownloadAssociatedFiles => "+Zotero.Prefs.get("downloadAssociatedFiles")
|
}
|
||||||
+ "\nautomaticSnapshots => "+Zotero.Prefs.get("automaticSnapshots");
|
if (Zotero.Prefs.get("downloadAssociatedFiles")) {
|
||||||
return errorString.substr(1);
|
errorString += "\ndownloadAssociatedFiles => true";
|
||||||
|
}
|
||||||
|
if (Zotero.Prefs.get("automaticSnapshots")) {
|
||||||
|
errorString += "\nautomaticSnapshots => true";
|
||||||
|
}
|
||||||
|
return errorString;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue