The scenario I am thinking about is where during the processing of a custom event used as the event for a turn based challenge and that will send a LogChallengeEventRequest.
What if something goes wrong during the execution of the script because of either cheating or other reasons and the event should return an error message to the client and not consume the turn.
In cloud code, how would i return an error message in the response and not consume the turn?
You could set a scriptError and use Spark.exit() to stop the turn and exit the script. Try the following in your LogChallengeEventRequest.
Spark.setScriptError("error", "my custom error") Spark.exit()
When you do this in your LogChallengeEventRequest the script will stop executing and the turn won't be taken and the ChallengeTurnTakenMessage won't be sent. You could pass the turn to the other player with SparkChallenges consumeTurn call if that would suit your implementation. Try that and let us know if you have any further questions.