We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 77fc0e8 commit 330ae91Copy full SHA for 330ae91
rflink/protocol.py
@@ -48,10 +48,15 @@ def connection_made(self, transport):
48
49
def data_received(self, data):
50
"""Add incoming data to buffer."""
51
- data = data.decode()
52
- log.debug('received data: %s', data.strip())
53
- self.buffer += data
54
- self.handle_lines()
+ try:
+ data = data.decode()
+ except UnicodeDecodeError:
+ invalid_data = data.decode(errors="replace")
55
+ log.warning("Error during decode of data, invalid data: %s", invalid_data)
56
+ else:
57
+ log.debug('received data: %s', data.strip())
58
+ self.buffer += data
59
+ self.handle_lines()
60
61
def handle_lines(self):
62
"""Assemble incoming data into per-line packets."""
0 commit comments