From d4a799b5cb9bb64062517ad7ce2248eaf732aca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Thu, 5 May 2016 11:06:26 +0100 Subject: [PATCH] Closes #981. Fixes feed-import (and possibly other feed) test unhandled rejections --- chrome/content/zotero/xpcom/feedReader.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/feedReader.js b/chrome/content/zotero/xpcom/feedReader.js index 0264843302..13c03d566d 100644 --- a/chrome/content/zotero/xpcom/feedReader.js +++ b/chrome/content/zotero/xpcom/feedReader.js @@ -186,7 +186,14 @@ Zotero.FeedReader.prototype.terminate = function(status) { // Reject feed item promise if not resolved yet let lastItem = this._feedItems[this._feedItems.length - 1]; if (lastItem.promise.isPending()) { - lastItem.reject(new Error(status)); + // It seemed like a good idea to reject the last item but + // it's not really been useful yet, aside from bluebird + // throwing errors about unhandled rejections in tests + // so we suppress them here. TODO: We should probably + // rethink whether this code makes sense and make it better. + let er = new Error(status); + er.handledRejection = true; + lastItem.reject(er); } // Close feed connection