I'm trying to pass exception to my main function with the traceback but its not working as expected.
import sys
import traceback
def test_function():
return 0/0
def task1():
try:
a = 1
test_function()
except Exception as e:
print e
traceback = sys.exc_info()[2]
raise Exception(), 'Error message', traceback
def main():
try:
task1()
except Exception, e:
print e
print 'start'
main()
print 'end'
Here is my result:-
start
integer division or modulo by zero
instance exception may not have a separate value
end