From 07c82694333db99c24d74103403e3dd5844c30f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Wed, 29 May 2019 11:24:50 +0300 Subject: [PATCH] Add an ability to throw non-error alerts from connector integration --- .../zotero/xpcom/connector/server_connectorIntegration.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/connector/server_connectorIntegration.js b/chrome/content/zotero/xpcom/connector/server_connectorIntegration.js index 24c4642f65..3cc8571523 100644 --- a/chrome/content/zotero/xpcom/connector/server_connectorIntegration.js +++ b/chrome/content/zotero/xpcom/connector/server_connectorIntegration.js @@ -63,7 +63,12 @@ Zotero.Server.Endpoints['/connector/document/respond'].prototype = { if (typeof data.stack != "string") { data.stack = JSON.stringify(data.stack); } - Zotero.HTTPIntegrationClient.deferredResponse.reject(data); + let error = data; + if (data.error == 'Alert') { + error = new Zotero.Exception.Alert(data.message); + error.stack = data.stack; + } + Zotero.HTTPIntegrationClient.deferredResponse.reject(error); } else { Zotero.HTTPIntegrationClient.deferredResponse.resolve(data); }