I am trying to custimize my error codes in a script that I am writing and I was wondering if I can adjust the output. Here is the scenario. Running this script:
while True:
try:
x = "Hello World"
int(x)
except (ValueError, RuntimeError, TypeError, NameError, SystemExit):
sys.exit("Error: Check Section 1.0")
Creates an output of:
An exception has occurred, use %tb to see the full traceback.
SystemExit: Error: Check Section 1.0
Is there an easy way, when an error occurs, the script stops and only says:
Error: Check Section 1.0