Procházet zdrojové kódy

adapter: demote wire corruption to warning, not unexpected error

Protobuf ParseFromString failures on the realtime WebSocket are
now caught by their cause type (DecodeError) and logged at WARNING
with 'wire corruption' instead of 'unexpected realtime error'.
This removes the misleading log line while keeping the reconnect
behavior unchanged.

No vendored files edited.
Paul Klumpp před 3 týdny
rodič
revize
b16ded4713
1 změnil soubory, kde provedl 13 přidání a 5 odebrání
  1. 13 5
      adapter.py

+ 13 - 5
adapter.py

@@ -1753,11 +1753,19 @@ class ChattoAdapter(BasePlatformAdapter):
                     delay,
                 )
             except Exception as exc:
-                logger.warning(
-                    "Chatto: unexpected realtime error: %s, reconnecting in %.1fs",
-                    exc,
-                    delay,
-                )
+                cause = exc.__cause__
+                if cause is not None and "ParseFromString" in str(type(cause).__name__):
+                    logger.warning(
+                        "Chatto: realtime wire corruption (%s), reconnecting in %.1fs",
+                        cause,
+                        delay,
+                    )
+                else:
+                    logger.warning(
+                        "Chatto: unexpected realtime error: %s, reconnecting in %.1fs",
+                        exc,
+                        delay,
+                    )
 
             if self._closing:
                 return