# HG changeset patch # User Goffi # Date 1701451346 -3600 # Node ID e92c32014024bcf85b4df7bda4e152f0ca6f84bf # Parent d67eaa684484d6210d32bc2e6156a33c06c532f8 component AP gateway: log a warning instead of raising an exception in `onMessage`: if something goes wrong, a warning is logged instead of raising a failing in `onMessage`'s `get_ap_actor_id_from_account` and `sign_and_post` calls. diff -r d67eaa684484 -r e92c32014024 libervia/backend/plugins/plugin_comp_ap_gateway/__init__.py --- a/libervia/backend/plugins/plugin_comp_ap_gateway/__init__.py Fri Dec 01 18:20:27 2023 +0100 +++ b/libervia/backend/plugins/plugin_comp_ap_gateway/__init__.py Fri Dec 01 18:22:26 2023 +0100 @@ -2277,7 +2277,14 @@ return mess_data actor_account = self._e.unescape(mess_data["to"].user) - actor_id = await self.get_ap_actor_id_from_account(actor_account) + try: + actor_id = await self.get_ap_actor_id_from_account(actor_account) + except Exception as e: + log.warning( + f"Can't retrieve data on actor {actor_account}: {e}" + ) + # TODO: send an error + return mess_data inbox = await self.get_ap_inbox_from_id(actor_id, use_shared=False) try: @@ -2313,7 +2320,13 @@ "name": f"@{actor_account}", }) - await self.sign_and_post(inbox, ap_item["actor"], ap_item) + try: + await self.sign_and_post(inbox, ap_item["actor"], ap_item) + except Exception as e: + # TODO: send an error + log.warning( + f"Can't send message to {inbox}: {e}" + ) return mess_data async def _on_message_retract(