Remove catch + sys.exit idiom

This is bad, python already prints exceptino message and exit with
non-zero code when an exception is raised, no need to catch the
exception just to print it. In addition, printing an exception does not
print stacktrace, so catch + sys.exit provide less information than
python's default behavior.

Test: th
Change-Id: If6cf2e34d4ebc9f7d172063b4396bf4377dad447
This commit is contained in:
Kelvin Zhang
2022-02-17 21:46:21 -08:00
parent 42ab828754
commit 07c71ac1b9
5 changed files with 0 additions and 15 deletions

View File

@@ -181,8 +181,5 @@ def main():
if __name__ == '__main__':
try:
main()
except AssertionError as err:
print('\n ERROR: %s\n' % (err,))
sys.exit(1)
finally:
common.Cleanup()

View File

@@ -300,8 +300,5 @@ if __name__ == "__main__":
try:
common.CloseInheritedPipes()
main(sys.argv[1:])
except common.ExternalError:
logger.exception("\n ERROR:\n")
sys.exit(1)
finally:
common.Cleanup()

View File

@@ -286,8 +286,5 @@ if __name__ == '__main__':
try:
common.CloseInheritedPipes()
main(sys.argv[1:])
except common.ExternalError:
logger.exception('\n ERROR:\n')
sys.exit(1)
finally:
common.Cleanup()

View File

@@ -251,8 +251,5 @@ if __name__ == '__main__':
try:
common.CloseInheritedPipes()
main(sys.argv[1:])
except common.ExternalError as e:
logger.exception('\n ERROR:\n')
sys.exit(1)
finally:
common.Cleanup()

View File

@@ -149,8 +149,5 @@ def main(argv):
if __name__ == '__main__':
try:
main(sys.argv[1:])
except common.ExternalError:
logger.exception("\n ERROR:\n")
sys.exit(1)
finally:
common.Cleanup()