Restore rejection of last feed item when FeedReader terminates

Without this, the "should reject if the provided url is not a valid
feed" test fails

Follow-up to #5412
This commit is contained in:
Dan Stillman 2025-07-29 02:34:41 -04:00
parent c1270e635e
commit 4a5689e9b6

View file

@ -221,6 +221,17 @@ Zotero.FeedReader.prototype.terminate = function (status) {
// Reject feed promise if not resolved yet
this._feedProcessed.reject(new Error(status));
// Reject feed item promise if not resolved yet
let lastItem = this._feedItems[this._feedItems.length - 1];
// 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.
// FIXME: fx140: We can no longer "handle" the rejection here
let er = new Error(status);
lastItem.reject(er);
};
Zotero.defineProperty(Zotero.FeedReader.prototype, 'feedProperties', {