www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit eb85fdc42e39e9c844169bc947f4e5487252f72a
parent 3ac4203a7574895e0b08ed3457757371147bd110
Author: Dan Stillman <dstillman@zotero.org>
Date:   Fri, 29 Jan 2016 05:10:49 -0500

An invalid translator file shouldn't break all translation

For now, delete it and clear it from the cache so it's updated properly going
forward, but really we want to reinstall the correct file automatically
(#903).

Diffstat:
Mchrome/content/zotero/xpcom/translation/translators.js | 16+++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/xpcom/translation/translators.js b/chrome/content/zotero/xpcom/translation/translators.js @@ -103,7 +103,21 @@ Zotero.Translators = new function() { } // Otherwise, load from file else { - var translator = yield Zotero.Translators.loadFromFile(path); + try { + var translator = yield Zotero.Translators.loadFromFile(path); + } + catch (e) { + Zotero.logError(e); + + // If translator file is invalid, delete it and clear the cache entry + // so that the translator is reinstalled the next time it's updated. + // + // TODO: Reinstall the correct translator immediately + yield OS.File.remove(path); + let sql = "DELETE FROM translatorCache WHERE fileName=?"; + yield Zotero.DB.queryAsync(sql, fileName); + continue; + } } // When can this happen?