Skip to content

Commit

Permalink
Merge pull request #123 from Pennycook/main-exceptions
Browse files Browse the repository at this point in the history
Ensure main() catches all exceptions
  • Loading branch information
Pennycook authored Nov 5, 2024
2 parents 4cb95e2 + 50a202a commit 3732c72
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions codebasin/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def warn(self):
meta_warning.warn()


def main():
def _main():
# Read command-line arguments
parser = argparse.ArgumentParser(
description="Code Base Investigator " + str(version),
Expand Down Expand Up @@ -359,10 +359,14 @@ def report_enabled(name):
sys.exit(0)


if __name__ == "__main__":
def main():
try:
sys.argv[0] = "codebasin"
main()
_main()
except Exception as e:
log.error(str(e))
sys.exit(1)


if __name__ == "__main__":
sys.argv[0] = "codebasin"
main()

0 comments on commit 3732c72

Please sign in to comment.