Add check to ensure that the game can start.

This commit is contained in:
Oliver-Akins 2020-10-09 16:49:53 -06:00
parent 64b5c49187
commit fd2857d055

View file

@ -25,6 +25,15 @@ export const StartGame = (io: Server, socket: Socket, data: StartGame) => {
};
// Ensure the game can be started
let start_error = game.start_error();
if (start_error) {
log.info(`Game ${game.code}: ${start_error}`);
socket.emit(`Starting`, {
success: false,
message: start_error,
});
return;
};
} catch (err) {
log.prettyError(err);
socket.emit(`Starting`, {