Browse Source

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 3 tuần trước cách đây
mục cha
commit
b16ded4713
1 tập tin đã thay đổi với 13 bổ sung và 5 xóa
  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