Tuesday 23 May 2017

Node js completion handler error

I am not understanding why I am getting an error:

FIREBASE WARNING: Exception was thrown by user callback. Error: Firebase.update failed: First argument contains a function in property 'Games.57274.function' with contents:

function(error){
         if (error) {
             console.log("Data could not be saved." + error);
         } else {
             counter++;
         }
}

My code is the following:

if(teamInfo.Name == gameInfo.AwayTeam) {
   let currGame = games.child(`${gSnap.key}`);

   currGame.update({
      "AwayTeam": teamInfo.Name,
      "AwayId": tSnap.key,
       function(error){
          if (error) {
               console.log("Data could not be saved." + error);
          } else {             
               counter++;
          }
       }
   });
}

I am not sure where the code is wrong?!



via Learn2Code

No comments:

Post a Comment