Better exception handling
This commit is contained in:
parent
127c3b810d
commit
a19ac4772b
1 changed files with 10 additions and 1 deletions
|
|
@ -38,12 +38,21 @@ if __name__ == '__main__':
|
||||||
if not re.search(r'(^$|help|-h|\?)', run_mode, re.IGNORECASE):
|
if not re.search(r'(^$|help|-h|\?)', run_mode, re.IGNORECASE):
|
||||||
print_error('Invalid mode.')
|
print_error('Invalid mode.')
|
||||||
show_usage(script_name)
|
show_usage(script_name)
|
||||||
exit_script()
|
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
print_standard('\nDone.')
|
print_standard('\nDone.')
|
||||||
pause("Press Enter to exit...")
|
pause("Press Enter to exit...")
|
||||||
exit_script()
|
exit_script()
|
||||||
|
except GenericAbort as ga:
|
||||||
|
if str(ga):
|
||||||
|
print_warning(str(ga))
|
||||||
|
abort()
|
||||||
|
except GenericError as ge:
|
||||||
|
if str(ge):
|
||||||
|
print_error(str(ge))
|
||||||
|
else:
|
||||||
|
print_error('Generic Error?')
|
||||||
|
abort()
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue