def exconly(self, tryshort=False): |
""" return the exception as a string |
|
when 'tryshort' resolves to True, and the exception is a |
py.magic.AssertionError, only the actual exception part of |
the exception representation is returned (so 'AssertionError: ' is |
removed from the beginning) |
""" |
lines = py.std.traceback.format_exception_only(self.type, self.value) |
text = ''.join(lines) |
if text.endswith('\n'): |
text = text[:-1] |
if tryshort: |
if text.startswith(self._striptext): |
text = text[len(self._striptext):] |
return text |