catch ClientConnectorError when fetching actor

This commit is contained in:
Izalia Mae 2024-09-28 06:56:27 -04:00
parent 5a9d1836d0
commit 098998084d

View file

@ -1,6 +1,7 @@
import aputils import aputils
import traceback import traceback
from aiohttp import ClientConnectorError
from aiohttp.web import Request from aiohttp.web import Request
from blib import HttpError from blib import HttpError
@ -104,6 +105,10 @@ class ActorView(View):
logging.debug('HTTP Status %i: %s', e.status, e.message) logging.debug('HTTP Status %i: %s', e.status, e.message)
raise HttpError(400, 'failed to fetch actor') raise HttpError(400, 'failed to fetch actor')
except ClientConnectorError as e:
logging.warning('Error when trying to fetch actor: %s, %s', self.signature.keyid, str(e))
raise HttpError(400, 'failed to fetch actor')
except Exception: except Exception:
traceback.print_exc() traceback.print_exc()
raise HttpError(500, 'unexpected error when fetching actor') raise HttpError(500, 'unexpected error when fetching actor')