Skip to content

Commit 21ad873

Browse files
committed
fix mypyp thing
1 parent 5bfa7e5 commit 21ad873

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

posthog/utils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,12 @@ def _clean_dataclass(dataclass_):
101101

102102
def _coerce_unicode(cmplx):
103103
try:
104-
item = cmplx.decode("utf-8", "strict")
105-
except AttributeError as exception:
106-
item = ":".join(exception)
107-
item.decode("utf-8", "strict")
108-
log.warning("Error decoding: %s", item)
104+
if isinstance(cmplx, bytes):
105+
item = cmplx.decode("utf-8", "strict")
106+
else:
107+
item = str(cmplx)
108+
except (AttributeError, UnicodeDecodeError) as exception:
109+
log.warning("Error decoding: %s", str(exception))
109110
return None
110111
return item
111112

0 commit comments

Comments
 (0)