Merge pull request #2040 from avaris/exception_logging_fixes

Fixes Exception name related bugs
This commit is contained in:
Justin Mayer 2016-10-29 12:57:46 -06:00 committed by GitHub
commit 594b9c9633
2 changed files with 3 additions and 2 deletions

View file

@ -473,5 +473,6 @@ def is_valid_content(content, f):
return True
except NameError as e:
logger.error(
"Skipping %s: could not find information about '%s'", f, e)
"Skipping %s: could not find information about '%s'",
f, six.text_type(e))
return False

View file

@ -157,7 +157,7 @@ class SafeLogger(logging.Logger):
so convert the message to unicode with the correct encoding
'''
if isinstance(arg, Exception):
text = '%s: %s' % (arg.__class__.__name__, arg)
text = str('%s: %s') % (arg.__class__.__name__, arg)
if six.PY2:
text = text.decode(self._exc_encoding)
return text