Adjust error response event name.
This commit is contained in:
parent
b0b8b1296e
commit
41d1a4f4d9
1 changed files with 4 additions and 3 deletions
|
|
@ -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`,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue