treevalue.utils.exception¶
str_traceback¶
-
treevalue.utils.exception.
str_traceback
(err: BaseException) → str[source]¶ - Overview:
Get full backtrace for exception object.
- Arguments:
err (
BaseException
): Exception object.
- Returns:
backtrace (
str
): Full string backtrace.
- Example:
>>> try: >>> raise RuntimeError('runtime error') >>> except Exception as err: >>> s = str_traceback(err)
The output should be like
>>> Traceback (most recent call last): >>> File "<stdin>", line 2, in <module> >>> raise RuntimeError('runtime error') >>> RuntimeError: runtime error