summaryrefslogtreecommitdiff
path: root/sw-server/src
diff options
context:
space:
mode:
Diffstat (limited to 'sw-server/src')
-rw-r--r--sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameBrowserController.kt7
1 files changed, 4 insertions, 3 deletions
diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameBrowserController.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameBrowserController.kt
index 9530a6b7..8e90eb27 100644
--- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameBrowserController.kt
+++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameBrowserController.kt
@@ -9,6 +9,7 @@ import org.luxons.sevenwonders.model.api.wrap
import org.luxons.sevenwonders.server.ApiMisuseException
import org.luxons.sevenwonders.server.api.toDTO
import org.luxons.sevenwonders.server.lobby.Lobby
+import org.luxons.sevenwonders.server.lobby.Player
import org.luxons.sevenwonders.server.repositories.LobbyRepository
import org.luxons.sevenwonders.server.repositories.PlayerRepository
import org.slf4j.LoggerFactory
@@ -95,12 +96,12 @@ class GameBrowserController(
private fun checkThatUserIsNotInAGame(principal: Principal, impossibleActionDescription: String) {
val player = playerRepository.get(principal.name)
if (player.isInLobby || player.isInGame) {
- throw UserAlreadyInGameException(player.lobby.name, impossibleActionDescription)
+ throw UserAlreadyInGameException(player, impossibleActionDescription)
}
}
- internal class UserAlreadyInGameException(gameName: String, impossibleActionDescription: String) :
- ApiMisuseException("Client already in game '$gameName', $impossibleActionDescription")
+ internal class UserAlreadyInGameException(player: Player, impossibleActionDescription: String) :
+ ApiMisuseException("Player $player is already in game '${player.lobby.name}', $impossibleActionDescription")
companion object {
private val logger = LoggerFactory.getLogger(GameBrowserController::class.java)
bgstack15