logging on post_json_to_model

This commit is contained in:
rimu 2024-03-09 12:15:58 +13:00
parent 690bb34eff
commit bacc0c81be

View file

@ -578,6 +578,7 @@ def actor_json_to_model(activity_json, address, server):
def post_json_to_model(post_json, user, community) -> Post:
try:
post = Post(user_id=user.id, community_id=community.id,
title=html.unescape(post_json['name']),
comments_enabled=post_json['commentsEnabled'],
@ -638,6 +639,9 @@ def post_json_to_model(post_json, user, community) -> Post:
community.post_count += 1
db.session.commit()
return post
except KeyError as e:
current_app.logger.error(f'KeyError in post_json_to_model: ' + str(post_json))
return None
# Save two different versions of a File, after downloading it from file.source_url. Set a width parameter to None to avoid generating one of that size