From ec325f9f082d0d021efc1329debf3229d4d7d4dd Mon Sep 17 00:00:00 2001 From: Izalia Mae Date: Wed, 16 Nov 2022 09:12:23 -0500 Subject: [PATCH] skip raising a KeyError on missing actor --- relay/views.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/relay/views.py b/relay/views.py index 900094f..80084a3 100644 --- a/relay/views.py +++ b/relay/views.py @@ -82,13 +82,10 @@ async def inbox(request): try: data = await request.json(loads=Message.new_from_json) + ## reject if there is no actor in the message if 'actor' not in data: - raise KeyError('actor') - - ## reject if there is no actor in the message - except KeyError: - logging.verbose('actor not in data') - return Response.new_error(400, 'no actor in message', 'json') + logging.verbose('actor not in data') + return Response.new_error(400, 'no actor in message', 'json') except: traceback.print_exc()