Selaa lähdekoodia

Refs #5128: Change return to throw error on callback missing

Chris Sexton 11 vuotta sitten
vanhempi
commit
645ddd73ef

+ 1 - 1
lib/pipeline/documentSources/SkipDocumentSource.js

@@ -40,7 +40,7 @@ proto.coalesce = function coalesce(nextSource) {
 };
 
 proto.getNext = function getNext(callback) {
-	if (!callback) return new Error(this.getSourceName() + ' #getNext() requires callback');
+	if (!callback) throw new Error(this.getSourceName() + ' #getNext() requires callback');
 
 	var self = this;
 

+ 1 - 1
test/lib/pipeline/documentSources/SkipDocumentSource.js

@@ -47,7 +47,7 @@ module.exports = {
 
 			"should throw an error if no callback is given": function() {
 				var sds = new SkipDocumentSource();
-				assert.throws(sds.getNext());
+				assert.throws(sds.getNext.bind(sds));
 			},
 
 			"should return EOF if there are no more sources": function noSources(next){