Skip to content

Commit

Permalink
Catch KeyError
Browse files Browse the repository at this point in the history
  • Loading branch information
gbtami committed Oct 27, 2023
1 parent 890ac0d commit ac83701
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/puzzle.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ async def puzzle_complete(request):

users = request.app["users"]
session = await aiohttp_session.get_session(request)
user = users[session.get("user_name")]
try:
user = users[session.get("user_name")]
except KeyError:
return web.json_response({})

if puzzleId in user.puzzles:
return web.json_response({})
Expand Down

0 comments on commit ac83701

Please sign in to comment.