Pārlūkot izejas kodu

Show error when room state update failed

subDesTagesMitExtraKaese 3 nedēļas atpakaļ
vecāks
revīzija
ca2ec87f9e
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  1. 4 1
      src/matrix_reportbot/classes/bot.py

+ 4 - 1
src/matrix_reportbot/classes/bot.py

@@ -14,6 +14,7 @@ from nio import (
     RoomLeaveError,
     RoomSendError,
     RoomGetStateError,
+    RoomPutStateError,
 )
 
 from typing import Optional, List
@@ -248,7 +249,9 @@ class ReportBot:
         response = await self.matrix_client.room_put_state(
             room, event_type, content, state_key
         )
-
+        if isinstance(response, RoomPutStateError):
+            self.logger.log(f"Failed to send state event in room {room}: {response.message}", "error")
+        
         return response
 
     async def get_state_event(