Merge pull request #991 from adomasven/fix/feed-import-test
Fixes feed-import (and possibly other feed) test unhandled rejections
This commit is contained in:
commit
b7ad582d99
|
@ -186,7 +186,14 @@ Zotero.FeedReader.prototype.terminate = function(status) {
|
||||||
// Reject feed item promise if not resolved yet
|
// Reject feed item promise if not resolved yet
|
||||||
let lastItem = this._feedItems[this._feedItems.length - 1];
|
let lastItem = this._feedItems[this._feedItems.length - 1];
|
||||||
if (lastItem.promise.isPending()) {
|
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
|
// Close feed connection
|
||||||
|
|
Loading…
Reference in New Issue
Block a user