Only display exception type if no traceback
Update test to match
This commit is contained in:
parent
164b2a3eef
commit
ce8b457bac
@ -92,9 +92,11 @@ class ConfigErrorDesc:
|
||||
traceback = attr.ib(None)
|
||||
|
||||
def __str__(self):
|
||||
return '{} - {}: {} '.format(self.text,
|
||||
self.exception.__class__.__name__,
|
||||
self.exception)
|
||||
if self.traceback:
|
||||
return '{} - {}: {} '.format(self.text,
|
||||
self.exception.__class__.__name__,
|
||||
self.exception)
|
||||
return '{}: {}'.format(self.text, self.exception)
|
||||
|
||||
def with_text(self, text):
|
||||
"""Get a new ConfigErrorDesc with the given text appended."""
|
||||
|
@ -74,7 +74,7 @@ def test_config_file_errors_str(errors):
|
||||
assert str(errors).splitlines() == [
|
||||
'Errors occurred while reading config.py:',
|
||||
' Error text 1: Exception 1',
|
||||
' Error text 2: Exception 2',
|
||||
' Error text 2 - Exception: Exception 2 ',
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user