Added logic to emit error for invalid game state transition