0
0
Fork 0

Adjust error response event name.

This commit is contained in:
Oliver-Akins 2021-01-03 16:16:53 -07:00
parent b0b8b1296e
commit 41d1a4f4d9

View file

@ -6,8 +6,8 @@ export default (io: Server, socket: Socket, data: GetPastQuestions) => {
// Assert game exists // Assert game exists
if (!games[data.game_code]) { if (!games[data.game_code]) {
log.debug(`Can't get questions game that doesn't exist: ${data.game_code}`); log.debug(`Can't find game with code: ${data.game_code}`);
socket.emit(`Error`, { socket.emit(`PastQuestions`, {
status: 404, status: 404,
message: `Game with code ${data.game_code} could not be found`, message: `Game with code ${data.game_code} could not be found`,
source: `GetPastQuestions` source: `GetPastQuestions`
@ -19,11 +19,12 @@ export default (io: Server, socket: Socket, data: GetPastQuestions) => {
game.log.silly(`Past questions retrieved for team ${data.team}`); game.log.silly(`Past questions retrieved for team ${data.team}`);
socket.emit(`PastQuestions`, { socket.emit(`PastQuestions`, {
status: 200,
questions: team.questions questions: team.questions
}); });
} }
catch (err) { catch (err) {
socket.emit(`Error`, { socket.emit(`PastQuestions`, {
status: 500, status: 500,
message: `${err.name}: ${err.message}`, message: `${err.name}: ${err.message}`,
source: `GetPastQuestions`, source: `GetPastQuestions`,