我该如何从异常对象本身获取完整的堆栈跟踪信息?
考虑以下代码作为问题的简化示例:
last_exception = None
try:
raise Exception('foo failed')
except Exception as e:
last_exception = e
# this happens somewhere else, decoupled from the original raise
print_exception_stack_trace(last_exception)