Fix reporting of error line numbers

This commit is contained in:
Simon Kornblith 2011-07-20 21:53:38 +00:00
parent 7a34d09f58
commit 936069165b
2 changed files with 6 additions and 8 deletions

View file

@ -1083,11 +1083,7 @@ Zotero.Translate.Base.prototype = {
} else { } else {
if(error) { if(error) {
// report error to console // report error to console
if(this.translator[0] && this.translator[0].logError) { Zotero.logError(error);
this.translator[0].logError(error.toString(), "exception");
} else {
Zotero.logError(error);
}
// report error to debug log // report error to debug log
this._debug("Translation using "+(this.translator && this.translator[0] && this.translator[0].label ? this.translator[0].label : "no translator")+" failed: \n"+errorString, 2); this._debug("Translation using "+(this.translator && this.translator[0] && this.translator[0].label ? this.translator[0].label : "no translator")+" failed: \n"+errorString, 2);
@ -1167,7 +1163,8 @@ Zotero.Translate.Base.prototype = {
try { try {
this._sandboxManager.eval("var translatorInfo = "+translator.code, this._sandboxManager.eval("var translatorInfo = "+translator.code,
["detect"+this._entryFunctionSuffix, "do"+this._entryFunctionSuffix, "exports"]); ["detect"+this._entryFunctionSuffix, "do"+this._entryFunctionSuffix, "exports"],
(translator.file ? translator.file.path : translator.label));
} catch(e) { } catch(e) {
this.complete(false, "Parse error: "+e.toString()); this.complete(false, "Parse error: "+e.toString());
return; return;
@ -1279,6 +1276,7 @@ Zotero.Translate.Base.prototype = {
errorString += "\n"+i+' => '+error[i]; errorString += "\n"+i+' => '+error[i];
} }
} }
errorString += "\nstring => "+error.toString();
} }
errorString += "\nurl => "+this.path errorString += "\nurl => "+this.path

View file

@ -128,8 +128,8 @@ Zotero.Translate.SandboxManager.prototype = {
/** /**
* Evaluates code in the sandbox * Evaluates code in the sandbox
*/ */
"eval":function(code) { "eval":function(code, exported, path) {
Components.utils.evalInSandbox(code, this.sandbox); Components.utils.evalInSandbox(code, this.sandbox, "1.8", path, 1);
}, },
/** /**