mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-11 01:35:28 +00:00
Check unsupported types before attempting to serialize
This commit is contained in:
parent
fd43b56d31
commit
b2775c5160
2 changed files with 3 additions and 3 deletions
|
@ -39,12 +39,12 @@ def naive_parse(activity_objects, activity_json, serializer=None):
|
|||
activity_json["type"] = "PublicKey"
|
||||
|
||||
activity_type = activity_json.get("type")
|
||||
if activity_type in ["Question", "Article"]:
|
||||
return None
|
||||
try:
|
||||
serializer = activity_objects[activity_type]
|
||||
except KeyError as err:
|
||||
# we know this exists and that we can't handle it
|
||||
if activity_type in ["Question", "Article"]:
|
||||
return None
|
||||
raise ActivitySerializerError(err)
|
||||
|
||||
return serializer(activity_objects=activity_objects, **activity_json)
|
||||
|
|
Loading…
Reference in a new issue