Преглед на файлове

Fix handling of KeysUploadError

Kumi преди 11 месеца
родител
ревизия
d4cf70b273
променени са 1 файла, в които са добавени 2 реда и са изтрити 3 реда
  1. 2 3
      src/gptbot/callbacks/roommember.py

+ 2 - 3
src/gptbot/callbacks/roommember.py

@@ -1,9 +1,8 @@
 from nio import RoomMemberEvent, MatrixRoom, KeysUploadError
 
 async def roommember_callback(room: MatrixRoom, event: RoomMemberEvent, bot):
-    try:
-        await bot.matrix_client.keys_upload()
-    except KeysUploadError as e:
+    upload = await bot.matrix_client.keys_upload()
+    if isinstance(upload, KeysUploadError):
         bot.logger.log(f"Failed to upload keys: {e.message}")
 
     if event.membership == "leave":