lib.exception_handling.* contains functions for handling exceptions generated by user code



Modify traceback to only include the user code’s execution frame Always call in this fashion:

e = sys.exc_info()
user_tb = get_user_codeframe(e[2]) or e[2]

so that you can get the original frame back if you need to (this is necessary because copying traceback objects is tricky and this is a good workaround)


tb (TracebackType) – Trace back information

Return type:

Union[TracebackType, bool]