added error handling when requesting to join non existing room #41

Merged
balazs merged 1 commits from bugfix/unhandled-error-when-trying-to-join-non-existing-room into develop 2021-05-08 20:59:29 +02:00
2 changed files with 9 additions and 0 deletions

View File

@ -410,6 +410,10 @@
MapGuesser.showModalWithContent('Error', 'This game is already started, you cannot join.');
break;
case 'game_not_found':
MapGuesser.showModalWithContent('Error', 'The game room was not found by this ID. Please check the link.');
break;
default:
MapGuesser.showModalWithContent('Error', 'Error code: \'' + error + '\'');
break

View File

@ -114,6 +114,11 @@ class GameController
}
$room = $this->multiRoomRepository->getByRoomId($roomId);
if(!isset($room)) {
return new JsonContent(['error' => 'game_not_found']);
}
$state = $room->getStateArray();
$map = $this->mapRepository->getById($state['mapId']);
$token = $this->getMultiToken($roomId);