Skip to content

Your lightweight open-source personal agent.

fix: log errors in silent exception handlers (matrix + weixin channels)

Vilius Vystartasba1e5036f5cc
diff --git a/nanobot/channels/matrix.py b/nanobot/channels/matrix.py
index 6919be874..899c72f0f 100644
--- a/nanobot/channels/matrix.py
+++ b/nanobot/channels/matrix.py
@@ -412,6 +412,7 @@ class MatrixChannel(BaseChannel):
try:
response = await self.client.content_repository_config()
except Exception:
+ self.logger.warning("Failed to fetch server upload limit", exc_info=True)
return None
upload_size = getattr(response, "upload_size", None)
if isinstance(upload_size, int) and upload_size > 0:
@@ -457,6 +458,7 @@ class MatrixChannel(BaseChannel):
filesize=size_bytes,
)
except Exception:
+ self.logger.warning("Media upload failed", exc_info=True)
return fail
upload_response = upload_result[0] if isinstance(upload_result, tuple) else upload_result
@@ -476,6 +478,7 @@ class MatrixChannel(BaseChannel):
try:
await self._send_room_content(room_id, content)
except Exception:
+ self.logger.warning("Failed to send room content to room_id=%s", room_id, exc_info=True)
return fail
return None
@@ -553,8 +556,8 @@ class MatrixChannel(BaseChannel):
# we are editing the same message all the time, so only the first time the event id needs to be set
buf.event_id = response.event_id
except Exception:
+ self.logger.warning("Stream send/edit failed for chat_id=%s", chat_id, exc_info=True)
await self._stop_typing_keepalive(chat_id, clear_typing=True)
- pass
def _register_event_callbacks(self) -> None:
diff --git a/nanobot/channels/weixin.py b/nanobot/channels/weixin.py
index dff830613..2fa0aa4c4 100644
--- a/nanobot/channels/weixin.py
+++ b/nanobot/channels/weixin.py
@@ -208,6 +208,7 @@ class WeixinChannel(BaseChannel):
self.config.base_url = base_url
return bool(self._token)
except Exception:
+ self.logger.warning("Failed to load Weixin account state", exc_info=True)
return False
def _save_state(self) -> None: