summaryrefslogtreecommitdiffstats
path: root/users/models
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-20 11:37:26 -0700
committerAndrew Godwin2022-11-20 11:37:26 -0700
commit7a4f9cf29327803597cd39a46df159df4fbabe6c (patch)
treedea0896006852cbc291d3c00068e537927a1a985 /users/models
parentef910c53b7537cff385510c446bb7e2498875194 (diff)
downloadtakahe-7a4f9cf29327803597cd39a46df159df4fbabe6c.tar.gz
takahe-7a4f9cf29327803597cd39a46df159df4fbabe6c.tar.bz2
takahe-7a4f9cf29327803597cd39a46df159df4fbabe6c.zip
Add error catching on actor fetch
Diffstat (limited to 'users/models')
-rw-r--r--users/models/identity.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/users/models/identity.py b/users/models/identity.py
index 53b6f80..5056ce0 100644
--- a/users/models/identity.py
+++ b/users/models/identity.py
@@ -297,11 +297,14 @@ class Identity(StatorModel):
if self.local:
raise ValueError("Cannot fetch local identities")
async with httpx.AsyncClient() as client:
- response = await client.get(
- self.actor_uri,
- headers={"Accept": "application/json"},
- follow_redirects=True,
- )
+ try:
+ response = await client.get(
+ self.actor_uri,
+ headers={"Accept": "application/json"},
+ follow_redirects=True,
+ )
+ except (httpx.ReadTimeout, httpx.ReadError):
+ return False
if response.status_code >= 400:
return False
document = canonicalise(response.json(), include_security=True)