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).
This commit is contained in:
parent
3ac4203a75
commit
eb85fdc42e
1 changed files with 15 additions and 1 deletions
|
@ -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?
|
||||
|
|
Loading…
Reference in a new issue