From 4b09137402ebbaa5ebfdb4ca26cfb704c5280211 Mon Sep 17 00:00:00 2001 From: aurimasv Date: Fri, 23 Nov 2012 23:06:05 -0600 Subject: [PATCH] Call complete() when no translators are set. Don't fail when a translator returns without throwing an error or completing an item. --- chrome/content/zotero/xpcom/translation/translate.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index ac2dd7f02f..2ae8355f9e 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -1045,7 +1045,7 @@ Zotero.Translate.Base.prototype = { this._currentState = "translate"; if(!this.translator || !this.translator.length) { - throw new Error("Failed: no translator specified"); + this.complete(false, new Error("No translator specified")); } this._libraryID = libraryID; @@ -2093,8 +2093,8 @@ Zotero.Translate.Search.prototype.setTranslator = function(translator) { */ Zotero.Translate.Search.prototype.complete = function(returnValue, error) { if(this._currentState == "translate" && (!this.newItems || !this.newItems.length)) { - Zotero.debug("Translate: Could not find a result using "+this.translator[0].label+": \n" - +this._generateErrorString(error), 3); + Zotero.debug("Translate: Could not find a result using "+this.translator[0].label, 3); + if(error) Zotero.debug(this._generateErrorString(error), 3); if(this.translator.length > 1) { this.translator.shift(); this.translate(this._libraryID, this._saveAttachments);