M
Mage
Hello,
def error_msg(msg):
sys.exit(msg)
try:
do_something()
if value != my_wish:
error_msg('Invalid input')
except:
print "Fatal IO or Network error"
This doesn't work because sys.exit raises an exception.
I know that I can define exception types after except, but there might
be many. Also I know I can write:
except:
if str(sys.exc_info()[0]) == 'exceptions.SystemExit':
raise
But honestly I would like simething like that:
except (!SystemExit):
Is this possible somehow?
Mage
def error_msg(msg):
sys.exit(msg)
try:
do_something()
if value != my_wish:
error_msg('Invalid input')
except:
print "Fatal IO or Network error"
This doesn't work because sys.exit raises an exception.
I know that I can define exception types after except, but there might
be many. Also I know I can write:
except:
if str(sys.exc_info()[0]) == 'exceptions.SystemExit':
raise
But honestly I would like simething like that:
except (!SystemExit):
Is this possible somehow?
Mage