MCPcopy Index your code
hub / github.com/RustPython/RustPython / format_exception

Function format_exception

Lib/traceback.py:146–159  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

144
145
146def 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
162def format_exception_only(exc, /, value=_sentinel, *, show_group=False, **kwargs):

Callers 5

__init__Method · 0.90
runMethod · 0.90
format_excFunction · 0.85

Calls 5

formatMethod · 0.95
_parse_value_tbFunction · 0.85
listClass · 0.85
TracebackExceptionClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected