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

ENH raise runtimeerror instead of calling sys.exit #4062

Merged
merged 1 commit into from Sep 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion conda_build/source.py
Expand Up @@ -612,7 +612,7 @@ def patch_or_reverse(patch, patch_args, cwd, stdout, stderr):

exception = None
if not isfile(path):
sys.exit('Error: no such patch: %s' % path)
raise RuntimeError('Error: no such patch: %s' % path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can raise SystemExit and keep "similar" to what happened before with a nicer way to catch. However, I agree that this is more like a run time error instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right and agreed a RuntimeError is better. The issue is if a user is catching errors, they cannot use Exception since SystemExit doesn't inherit from that. Asking users to catch SystemExit is dangerous and definitely a python anti-pattern.


if config.verbose:
stdout = None
Expand Down