Fix error when DB backup can't be opened

This commit is contained in:
Dan Stillman 2017-02-25 18:09:15 -05:00
parent cb5e1fa431
commit b2b751e0a0

View file

@ -1057,23 +1057,13 @@ Zotero.DBConnection.prototype.backupDatabase = Zotero.Promise.coroutine(function
var connection = storageService.openDatabase(Zotero.File.pathToFile(tmpFile));
}
catch (e) {
this._debug("Database file '" + OS.Path.basename(tmpFile) + "' is corrupt -- skipping backup");
Zotero.logError(e);
this._debug("Database file '" + OS.Path.basename(tmpFile) + "' can't be opened -- skipping backup");
if (yield OS.File.exists(tmpFile)) {
yield OS.File.remove(tmpFile);
}
return false;
}
finally {
let resolve;
connection.asyncClose({
complete: function () {
resolve();
}
});
yield new Zotero.Promise(function () {
resolve = arguments[0];
});
}
// Special backup
if (!suffix && numBackups > 1) {