Return the promise in Zotero.Translators.loadFromDisk()

This commit is contained in:
Dan Stillman 2013-08-20 12:43:39 -04:00
parent c1211b0357
commit ccc18dd41e

View file

@ -152,7 +152,7 @@ Zotero.Translators = new function() {
*/ */
this.loadFromDisk = function(file) { this.loadFromDisk = function(file) {
const infoRe = /^\s*{[\S\s]*?}\s*?[\r\n]/; const infoRe = /^\s*{[\S\s]*?}\s*?[\r\n]/;
Zotero.File.getContentsAsync(this.file).then(function(source) { return Zotero.File.getContentsAsync(this.file).then(function(source) {
return Zotero.Translators.load(file, infoRe.exec(source)[0], source); return Zotero.Translators.load(file, infoRe.exec(source)[0], source);
}).fail(function() { }).fail(function() {
throw "Invalid or missing translator metadata JSON object in " + file.leafName; throw "Invalid or missing translator metadata JSON object in " + file.leafName;