try latin-1 if utf-8 doesn't work, when decoding exception strings

main
ndparker 7 years ago
parent 43c9279c8d
commit 911c5e0ca3

@ -779,7 +779,10 @@ class Worker(object):
def _get_safe_exception_string(exc_strings):
"""Ensure list of exception strings is decoded on Python 2 and joined as one string safely."""
if sys.version_info[0] < 3:
try:
exc_strings = [exc.decode("utf-8") for exc in exc_strings]
except ValueError:
exc_strings = [exc.decode("latin-1") for exc in exc_strings]
return ''.join(exc_strings)
def push_exc_handler(self, handler_func):

Loading…
Cancel
Save