Skip to content

Commit fab9db4

Browse files
authored
fix consumer decode when the message is encrypted (#4)
Signed-off-by: Francisco Vila <[email protected]>
1 parent 39735eb commit fab9db4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Consumer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
def get_value_from_type(obj):
1616
value_str = obj
1717
if isinstance(obj, bytes):
18-
value_str = obj.decode("utf-8")
18+
try:
19+
value_str = obj.decode("utf-8")
20+
except UnicodeDecodeError:
21+
value_str = "".join(map(chr, obj))
1922
if isinstance(obj, list):
2023
value_str = [get_value_from_type(x) for x in obj]
2124
if isinstance(obj, tuple):

0 commit comments

Comments
 (0)