Просмотр исходного кода

Add missing return on callback

James Allen 10 лет назад
Родитель
Сommit
a7f44bcd01

+ 1 - 1
services/track-changes/app/coffee/DiffManager.coffee

@@ -71,7 +71,7 @@ module.exports = DiffManager =
 			if lastUpdate? and lastUpdate.v != version - 1
 				error = new Error("latest update version, #{lastUpdate.v}, does not match doc version, #{version}")
 				error.retry = true
-				callback error
+				return callback error
 			
 			logger.log {docVersion: version, lastUpdateVersion: lastUpdate?.v, updateCount: updates.length}, "rewinding updates"
 

+ 1 - 3
services/track-changes/test/unit/coffee/DiffManager/DiffManagerTests.coffee

@@ -204,9 +204,7 @@ describe "DiffManager", ->
 				@DiffManager._tryGetDocumentBeforeVersion @project_id, @doc_id, @fromVersion, @callback
 
 			it "should call the callback with an error with retry = true set", ->
-				@callback
-					.calledWith(new Error("latest update version, 40, does not match doc version, 42"))
-					.should.equal true
+				@callback.calledOnce.should.equal true
 				error = @callback.args[0][0]
 				expect(error.retry).to.equal true