Ver Fonte

Log direct thread paths that failed to parse

Tulir Asokan há 4 anos atrás
pai
commit
912bec82f2
1 ficheiros alterados com 8 adições e 4 exclusões
  1. 8 4
      mauigpapi/mqtt/conn.py

+ 8 - 4
mauigpapi/mqtt/conn.py

@@ -211,10 +211,14 @@ class AndroidMQTT:
     # region Incoming event parsing
     # region Incoming event parsing
 
 
     def _parse_direct_thread_path(self, path: str) -> dict:
     def _parse_direct_thread_path(self, path: str) -> dict:
-        blank, direct_v2, threads, thread_id, *rest = path.split("/")
-        assert blank == ""
-        assert direct_v2 == "direct_v2"
-        assert threads == "threads"
+        try:
+            blank, direct_v2, threads, thread_id, *rest = path.split("/")
+            assert blank == ""
+            assert direct_v2 == "direct_v2"
+            assert threads == "threads"
+        except (AssertionError, ValueError) as e:
+            self.log.debug(f"Got {e} while parsing path {path}")
+            raise
         additional = {
         additional = {
             "thread_id": thread_id
             "thread_id": thread_id
         }
         }