From 5b5da4140bf9c59a7c5d8701a4c53fb9651693a7 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 10 May 2017 02:32:21 -0400 Subject: [PATCH] Display connection error when linking sync account --- .../zotero/preferences/preferences_sync.js | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/preferences/preferences_sync.js b/chrome/content/zotero/preferences/preferences_sync.js index cd2e9410a..e62b42f68 100644 --- a/chrome/content/zotero/preferences/preferences_sync.js +++ b/chrome/content/zotero/preferences/preferences_sync.js @@ -130,9 +130,23 @@ Zotero_Preferences.Sync = { // Try to acquire API key with current credentials this.updateSyncIndicator('animated'); - var json = yield Zotero.Sync.Runner.createAPIKeyFromCredentials(username, password); - this.updateSyncIndicator(); - + try { + var json = yield Zotero.Sync.Runner.createAPIKeyFromCredentials(username, password); + } + catch (e) { + setTimeout(function () { + Zotero.alert( + window, + Zotero.getString('general.error'), + e.message + ); + }); + throw e; + } + finally { + this.updateSyncIndicator(); + } + // Invalid credentials if (!json) { Zotero.alert(window,