Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: catch all wallet messaging exceptions #209

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading