From df6081edf98e655904af3a2db99e6ce66e5a24f9 Mon Sep 17 00:00:00 2001 From: Mawoka Date: Tue, 27 Sep 2022 22:18:33 +0200 Subject: [PATCH] :goal_net: Catching bug in live-API --- classquiz/routers/live.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classquiz/routers/live.py b/classquiz/routers/live.py index 87f4746..a1e4ea2 100644 --- a/classquiz/routers/live.py +++ b/classquiz/routers/live.py @@ -69,7 +69,10 @@ async def get_live_game_data( right=answer.right, answer=answer.answer, color=answer.color, color_code=color ) - data = GameSession.parse_raw(await redis.get(f"game_session:{game_pin}")) + data_redis_res = await redis.get(f"game_session:{game_pin}") + if data_redis_res is None: + raise HTTPException(status_code=404, detail="Game not found or API key not found") + data = GameSession.parse_raw(data_redis_res) for i in range(0, len(game.questions)): res = await redis.get(f"game_session:{game_pin}:{i}") if res is None: