Added error handling for findNearestBetterSessionID

This commit is contained in:
Michael Schmatz 2014-05-20 15:55:23 -07:00
parent a7f24ab04f
commit 47c41e0a6e

View file

@ -614,6 +614,7 @@ determineIfSessionShouldContinueAndUpdateLog = (cb) ->
findNearestBetterSessionID = (cb) -> findNearestBetterSessionID = (cb) ->
try
levelOriginalID = @levelSession.level.original levelOriginalID = @levelSession.level.original
levelMajorVersion = @levelSession.level.majorVersion levelMajorVersion = @levelSession.level.majorVersion
sessionID = @clientResponseObject.originalSessionID sessionID = @clientResponseObject.originalSessionID
@ -621,6 +622,8 @@ findNearestBetterSessionID = (cb) ->
opponentSessionID = _.pull(_.keys(@newScoresObject), sessionID) opponentSessionID = _.pull(_.keys(@newScoresObject), sessionID)
opponentSessionTotalScore = @newScoresObject[opponentSessionID].totalScore opponentSessionTotalScore = @newScoresObject[opponentSessionID].totalScore
opposingTeam = calculateOpposingTeam(@clientResponseObject.originalSessionTeam) opposingTeam = calculateOpposingTeam(@clientResponseObject.originalSessionTeam)
catch e
cb e
retrieveAllOpponentSessionIDs sessionID, (err, opponentSessionIDs) -> retrieveAllOpponentSessionIDs sessionID, (err, opponentSessionIDs) ->
if err? then return cb err, null if err? then return cb err, null