From 41d1a4f4d98cc8361a96bd256c9cf7b382112a36 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 3 Jan 2021 16:16:53 -0700 Subject: [PATCH] Adjust error response event name. --- server/src/events/GetPastQuestions.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/src/events/GetPastQuestions.ts b/server/src/events/GetPastQuestions.ts index 509ac0d..8a7100d 100644 --- a/server/src/events/GetPastQuestions.ts +++ b/server/src/events/GetPastQuestions.ts @@ -6,8 +6,8 @@ export default (io: Server, socket: Socket, data: GetPastQuestions) => { // Assert game exists if (!games[data.game_code]) { - log.debug(`Can't get questions game that doesn't exist: ${data.game_code}`); - socket.emit(`Error`, { + log.debug(`Can't find game with code: ${data.game_code}`); + socket.emit(`PastQuestions`, { status: 404, message: `Game with code ${data.game_code} could not be found`, source: `GetPastQuestions` @@ -19,11 +19,12 @@ export default (io: Server, socket: Socket, data: GetPastQuestions) => { game.log.silly(`Past questions retrieved for team ${data.team}`); socket.emit(`PastQuestions`, { + status: 200, questions: team.questions }); } catch (err) { - socket.emit(`Error`, { + socket.emit(`PastQuestions`, { status: 500, message: `${err.name}: ${err.message}`, source: `GetPastQuestions`,