BaseException.with_traceback (traceback)
traceback - Trace object. For example from sys.exc_info () [2].
Typically used as follows:
import sys
class MyException (Exception):
"" "Custom exception." ""
try:
raise Exception (’Ruined.’)
except Exception :
traceback = sys.exc_info () [2]
raise MyException (’one’,’ two’) .with_traceback (traceback)
Raise a new one exception using the method in question, then the resulting trace will contain information about the exception that was originally raised.