Fail schemaUpdatePromise and show alert on initialization failure

This will also cause the word processor plugin to throw an error isntead
of hanging if there was a problem loading translators or styles.

Closes #1557
This commit is contained in:
Dan Stillman 2018-08-21 22:33:13 -04:00
parent 475bd17b71
commit 91a3c27235
2 changed files with 43 additions and 9 deletions

View file

@ -221,19 +221,52 @@ Zotero.Schema = new function(){
// In Standalone, don't load bundled files until after UI is ready. In Firefox, load them as
// soon initialization is done so that translation works before the Zotero pane is opened.
(Zotero.isStandalone ? Zotero.uiReadyPromise : Zotero.initializationPromise)
.delay(1000)
.then(async function () {
await this.updateBundledFiles();
if (Zotero.Prefs.get('automaticScraperUpdates')) {
.then(() => {
setTimeout(async function () {
try {
await this.updateFromRepository(this.REPO_UPDATE_STARTUP);
await this.updateBundledFiles();
if (Zotero.Prefs.get('automaticScraperUpdates')) {
try {
await this.updateFromRepository(this.REPO_UPDATE_STARTUP);
}
catch (e) {
Zotero.logError(e);
}
}
_schemaUpdateDeferred.resolve(true);
}
catch (e) {
Zotero.logError(e);
let kbURL = 'https://www.zotero.org/support/kb/unable_to_load_translators_and_styles';
let msg = Zotero.getString('startupError.bundledFileUpdateError', Zotero.clientName);
let ps = Services.prompt;
let buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING
+ ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL
+ ps.BUTTON_POS_2 * ps.BUTTON_TITLE_IS_STRING;
let index = ps.confirmEx(
null,
Zotero.getString('general.error'),
msg,
buttonFlags,
Zotero.getString('general.moreInformation'),
"",
Zotero.getString('errorReport.reportError'),
null, {}
);
_schemaUpdateDeferred.reject(e);
if (index == 0) {
Zotero.launchURL(kbURL);
}
else if (index == 2) {
setTimeout(function () {
Zotero.getActiveZoteroPane().reportErrors();
}, 250);
}
}
}
_schemaUpdateDeferred.resolve(true);
}.bind(this));
}.bind(this), 1000);
});
return updated;
});

View file

@ -189,6 +189,7 @@ startupError.zoteroVersionIsOlder.current = Current version: %S
startupError.zoteroVersionIsOlder.upgrade = Please upgrade to the latest version from %S.
startupError.databaseUpgradeError = Database upgrade error
startupError.internetFunctionalityMayNotWork = Functionality that depends on an internet connection may not work.
startupError.bundledFileUpdateError = %S was unable to load translators and styles.
date.relative.secondsAgo.one = 1 second ago
date.relative.secondsAgo.multiple = %S seconds ago