Add an ability to throw non-error alerts from connector integration

This commit is contained in:
Adomas Venčkauskas 2019-05-29 11:24:50 +03:00
parent fedd6f8241
commit 07c8269433

View file

@ -63,7 +63,12 @@ Zotero.Server.Endpoints['/connector/document/respond'].prototype = {
if (typeof data.stack != "string") { if (typeof data.stack != "string") {
data.stack = JSON.stringify(data.stack); 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 { } else {
Zotero.HTTPIntegrationClient.deferredResponse.resolve(data); Zotero.HTTPIntegrationClient.deferredResponse.resolve(data);
} }