diff options
author | Andrew Godwin | 2022-11-20 12:24:03 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-11-20 12:24:03 -0700 |
commit | 77643a4fe144cb908a372a2ceb99f36634457ca5 (patch) | |
tree | 92e37e8a9e242a31d915eb60a0ab0c14bda2bcec /users | |
parent | facdd2c08094ad378351375541fa8e65459fa8d1 (diff) | |
download | takahe-77643a4fe144cb908a372a2ceb99f36634457ca5.tar.gz takahe-77643a4fe144cb908a372a2ceb99f36634457ca5.tar.bz2 takahe-77643a4fe144cb908a372a2ceb99f36634457ca5.zip |
Add more error handling
Diffstat (limited to 'users')
-rw-r--r-- | users/models/identity.py | 4 | ||||
-rw-r--r-- | users/models/inbox_message.py | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/users/models/identity.py b/users/models/identity.py index 452bde7..a78a451 100644 --- a/users/models/identity.py +++ b/users/models/identity.py @@ -277,7 +277,7 @@ class Identity(StatorModel): headers={"Accept": "application/json"}, follow_redirects=True, ) - except (httpx.ReadTimeout, httpx.ReadError, httpx.RemoteProtocolError): + except httpx.RequestError: return None, None if response.status_code >= 400: return None, None @@ -306,7 +306,7 @@ class Identity(StatorModel): headers={"Accept": "application/json"}, follow_redirects=True, ) - except (httpx.ReadTimeout, httpx.ReadError, httpx.RemoteProtocolError): + except httpx.RequestError: return False if response.status_code >= 400: return False diff --git a/users/models/inbox_message.py b/users/models/inbox_message.py index ee23ae6..fc81d71 100644 --- a/users/models/inbox_message.py +++ b/users/models/inbox_message.py @@ -65,6 +65,9 @@ class InboxMessageStates(StateGraph): f"Cannot handle activity of type undo.{unknown}" ) case "delete": + # If there is no object type, it's probably a profile + if not isinstance(instance.message["object"], dict): + raise ValueError("Cannot handle activity of type delete") match instance.message_object_type: case "tombstone": await sync_to_async(Post.handle_delete_ap)(instance.message) |