From 77643a4fe144cb908a372a2ceb99f36634457ca5 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sun, 20 Nov 2022 12:24:03 -0700 Subject: [PATCH] Add more error handling --- static/img/icon-admin.svg | 8 ++++---- stator/models.py | 5 +++++ stator/runner.py | 7 ++++++- takahe/settings/base.py | 2 ++ takahe/settings/production.py | 1 + users/models/identity.py | 4 ++-- users/models/inbox_message.py | 3 +++ 7 files changed, 23 insertions(+), 7 deletions(-) diff --git a/static/img/icon-admin.svg b/static/img/icon-admin.svg index d495b6f..6e343c0 100644 --- a/static/img/icon-admin.svg +++ b/static/img/icon-admin.svg @@ -11,8 +11,8 @@ inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)" sodipodi:docname="icon-admin.svg" inkscape:export-filename="icon-admin-512.png" - inkscape:export-xdpi="12.000001" - inkscape:export-ydpi="12.000001" + inkscape:export-xdpi="48.000004" + inkscape:export-ydpi="48.000004" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:xlink="http://www.w3.org/1999/xlink" @@ -29,8 +29,8 @@ inkscape:document-units="mm" showgrid="false" inkscape:zoom="0.5946522" - inkscape:cx="761.78983" - inkscape:cy="461.61437" + inkscape:cx="765.99397" + inkscape:cy="467.50016" inkscape:current-layer="layer1">= 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)