Skip to content

Commit

Permalink
fix: catch all wallet messaging exceptions (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrriehl authored Dec 14, 2023
1 parent e313800 commit e4bb19a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion python/src/uagents/wallet_messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ def handler(*args, **kwargs):
return decorator_on_message

async def send(self, destination: str, msg: str, msg_type: int = 1):
self._client.send(destination, msg, msg_type)
try:
self._client.send(destination, msg, msg_type)
except Exception as ex:
self._logger.exception(f"Failed to send message to {destination}: {ex}")

async def poll_server(self):
self._logger.info("Connecting to wallet messaging server")
Expand All @@ -72,6 +75,7 @@ async def poll_server(self):
HTTPError,
ConnectionError,
JSONDecodeError,
Exception,
) as ex:
self._logger.warning(
f"Failed to get messages from wallet messaging server: {ex}"
Expand Down

0 comments on commit e4bb19a

Please sign in to comment.