I have created a function, but errors could pop up. That is why I want to use exceptions to generalize all errors into the same message.
However, this function contains multiple sys.exit()
calls.
As a result, I would like to have my code jump into the except
handler if an error was raised, unless it is caused by sys.exit()
. How do I do this?
try:
myFunction()
except:
print "Error running myFunction()"
def myFunction():
sys.exit("Yolo")