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)
| 154 | |
| 155 | |
| 156 | def format_exception(exc, /, value=_sentinel, tb=_sentinel, limit=None, \ |
| 157 | chain=True, **kwargs): |
| 158 | """Format a stack trace and the exception information. |
| 159 | |
| 160 | The arguments have the same meaning as the corresponding arguments |
| 161 | to print_exception(). The return value is a list of strings, each |
| 162 | ending in a newline and some containing internal newlines. When |
| 163 | these lines are concatenated and printed, exactly the same text is |
| 164 | printed as does print_exception(). |
| 165 | """ |
| 166 | colorize = kwargs.get("colorize", False) |
| 167 | value, tb = _parse_value_tb(exc, value, tb) |
| 168 | te = TracebackException(type(value), value, tb, limit=limit, compact=True) |
| 169 | return list(te.format(chain=chain, colorize=colorize)) |
| 170 | |
| 171 | |
| 172 | def format_exception_only(exc, /, value=_sentinel, *, show_group=False, **kwargs): |
no test coverage detected
searching dependent graphs…