From 9c4d88c8fd67809d7dd5f9303c81b7a3804b7a80 Mon Sep 17 00:00:00 2001 From: Untone Date: Mon, 6 May 2024 20:59:56 +0300 Subject: [PATCH] handle-noauthor --- resolvers/editor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resolvers/editor.py b/resolvers/editor.py index 41ab8391..96908c93 100644 --- a/resolvers/editor.py +++ b/resolvers/editor.py @@ -108,7 +108,9 @@ async def get_shouts_drafts(_, info): @login_required async def create_shout(_, info, inp): user_id = info.context.get("user_id") - author_dict = info.context["author"] + author_dict = info.context.get("author") + if not author_dict: + return {"error": "author profile was not found"} author_id = author_dict.get("id") if user_id and author_id: with local_session() as session: