commit 9b54ca9ca779fcaa10d1f62b371d48c8c179e085
parent a15261b3b3015667fb6d5151391b2d28d05fc7c4
Author: Dan Stillman <dstillman@zotero.org>
Date: Tue, 27 Jun 2017 01:09:01 -0400
Show error and doc prefs if style can't be found or retrieved
Previously a 404 downloading the file would prevent opening the doc
prefs window.
Diffstat:
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js
@@ -1049,9 +1049,26 @@ Zotero.Integration.Document.prototype._getSession = Zotero.Promise.coroutine(fun
if (/^https?:\/\/(www\.)?(zotero\.org|citationstyles\.org)/.test(data.style.styleID) ||
me._doc.displayAlert(displayError, DIALOG_ICON_WARNING, DIALOG_BUTTONS_YES_NO)) {
- yield Zotero.Styles.install({url: data.style.styleID}, data.style.styleID, true);
- yield this._session.setData(data, true);
- return Zotero.Promise.resolve(this._session);
+ let installed = false;
+ try {
+ yield Zotero.Styles.install(
+ {url: data.style.styleID}, data.style.styleID, true
+ );
+ installed = true;
+ }
+ catch (e) {
+ me._doc.displayAlert(
+ Zotero.getString(
+ 'integration.error.styleNotFound', data.style.styleID
+ ),
+ DIALOG_ICON_WARNING,
+ DIALOG_BUTTONS_OK
+ );
+ }
+ if (installed) {
+ yield this._session.setData(data, true);
+ return Zotero.Promise.resolve(this._session);
+ }
}
}
return this._session.setDocPrefs(this._doc, this._app.primaryFieldType,
diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties
@@ -827,6 +827,7 @@ integration.error.deletePipe = The pipe that Zotero uses to communicate with t
integration.error.invalidStyle = The style you have selected does not appear to be valid. If you have created this style yourself, please ensure that it passes validation as described at https://github.com/citation-style-language/styles/wiki/Validation. Alternatively, try selecting another style.
integration.error.fieldTypeMismatch = Zotero cannot update this document because it was created by a different word processing application with an incompatible field encoding. In order to make a document compatible with both Word and LibreOffice, open the document in the word processor with which it was originally created and switch the field type to Bookmarks in the Zotero Document Preferences.
integration.error.styleMissing = The citation style used in this document is missing. Would you like to install it from %S?
+integration.error.styleNotFound = The citation style %S could not be found.
integration.replace = Replace this Zotero field?
integration.missingItem.single = The highlighted citation no longer exists in your Zotero database. Do you want to select a substitute item?