Format a stack trace and the exception information. The arguments have the same meaning as the corresponding arguments to print_exception(). The return value is a list of strings, each ending in a newline and some containing internal newlines. When these lines are concatenated and
(exc, /, value=_sentinel, tb=_sentinel, limit=None, \
chain=True, **kwargs)
| 144 | |
| 145 | |
| 146 | def format_exception(exc, /, value=_sentinel, tb=_sentinel, limit=None, \ |
| 147 | chain=True, **kwargs): |
| 148 | """Format a stack trace and the exception information. |
| 149 | |
| 150 | The arguments have the same meaning as the corresponding arguments |
| 151 | to print_exception(). The return value is a list of strings, each |
| 152 | ending in a newline and some containing internal newlines. When |
| 153 | these lines are concatenated and printed, exactly the same text is |
| 154 | printed as does print_exception(). |
| 155 | """ |
| 156 | colorize = kwargs.get("colorize", False) |
| 157 | value, tb = _parse_value_tb(exc, value, tb) |
| 158 | te = TracebackException(type(value), value, tb, limit=limit, compact=True) |
| 159 | return list(te.format(chain=chain, colorize=colorize)) |
| 160 | |
| 161 | |
| 162 | def format_exception_only(exc, /, value=_sentinel, *, show_group=False, **kwargs): |
no test coverage detected