From 2252c237940758506ad0b4f58b8e3f326a36b51a Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Thu, 29 Feb 2024 11:01:52 +1300 Subject: [PATCH] debug typeerror exceptions --- app/activitypub/routes.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/activitypub/routes.py b/app/activitypub/routes.py index 92b3cc06..07b947a4 100644 --- a/app/activitypub/routes.py +++ b/app/activitypub/routes.py @@ -460,12 +460,22 @@ def process_inbox_request(request_json, activitypublog_id, ip_address): in_reply_to = request_json['object']['inReplyTo'] if 'inReplyTo' in request_json['object'] else None if not in_reply_to: if can_create_post(user, community): - post = create_post(activity_log, community, request_json, user) + try: + post = create_post(activity_log, community, request_json, user) + except TypeError as e: + activity_log.exception_message = 'TypeError. See log file.' + current_app.logger.error('TypeError: ' + str(request_json)) + post = None else: post = None else: if can_create_post_reply(user, community): - post = create_post_reply(activity_log, community, in_reply_to, request_json, user) + try: + post = create_post_reply(activity_log, community, in_reply_to, request_json, user) + except TypeError as e: + activity_log.exception_message = 'TypeError. See log file.' + current_app.logger.error('TypeError: ' + str(request_json)) + post = None else: post = None else: