I have some code that handles an exception, and I want to do something specific only if it\'s a specific exception, and only in debug mode. So for example:
try:
stuff()
except KeyboardInterrupt:
if _debug:
sys.exit()
logging.exception("Normal handling")
except ValueError:
if _debug:
sys.exit()
logging.exception("Value error Normal handling")
else:
logging.info("One more message without exception")