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) SystemExits Not Thrown and Caught #3

Open
zhanwenchen opened this issue Sep 23, 2024 · 1 comment
Open

(BUG) SystemExits Not Thrown and Caught #3

zhanwenchen opened this issue Sep 23, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@zhanwenchen
Copy link
Owner

Currently, most exceptions are generic Exceptions and are caught without reraising. This prohibits any fatal exceptions from cascading into a desired system exit. Instead, 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

We also want to raise SystemExits from specific Exceptions (e.g., RuntimeError) for fatal errors.

@zhanwenchen zhanwenchen added the bug Something isn't working label Sep 23, 2024
@zhanwenchen zhanwenchen self-assigned this Sep 23, 2024
@zhanwenchen
Copy link
Owner Author

Problem is that SystemExits are handled differently from other built-in Exceptions. It's truncated.

In the long term, we should only catch and raise repo-specific exceptions in most circumstances. Generic Exceptions still should not be caught.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant