Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(BUG FIX) Catching SystemExits Independently from Generic Exceptions #22

Conversation

zhanwenchen
Copy link

@zhanwenchen zhanwenchen commented Sep 22, 2024

Currently, all Exceptions are caught and few, if any, are reraised. This prohibits any fatal exceptions from forcing a system exit. Essentially, we want to catch and reraise fatal errors (SystemExits) independently from generic Exceptions like this:

From:

try:
    ...
except Exception as e:
    print(...)
    pass

To:

try:
    ...
except SystemExit as e:
    raise SystemExit('FATAL ERROR ...') from e
except Exception as e:
    print(...)
    pass

See equivalent issue in my fork: zhanwenchen#1

@zhanwenchen zhanwenchen force-pushed the 1-bug-fix-catching-systemexit-exceptions branch from 487f90c to 888b568 Compare September 22, 2024 23:14
@zhanwenchen
Copy link
Author

NOTE: changed diff base to yours by cherry-picking commits and force-push-with-lease.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant