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

ENH raise runtimeerror instead of calling sys.exit #4062

merged 1 commit into from Sep 28, 2020

Conversation

beckermr
Copy link
Contributor

@beckermr beckermr commented Sep 18, 2020

@anaconda-issue-bot anaconda-issue-bot added the cla-signed [bot] added once the contributor has signed the CLA label Sep 18, 2020
@@ -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.

@mingwandroid mingwandroid merged commit f31ce38 into conda:master Sep 28, 2020
@mingwandroid
Copy link
Contributor

Thanks @beckermr

@beckermr beckermr deleted the patch-1 branch September 28, 2020 13:14
@github-actions
Copy link

Hi there, thank you for your contribution!

This pull request has been automatically locked because it has not had recent activity after being closed.

Please open a new issue or pull request if needed.

Thanks!

@github-actions github-actions bot added the locked [bot] locked due to inactivity label Mar 10, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed [bot] added once the contributor has signed the CLA locked [bot] locked due to inactivity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

conda build calls sys.exit when downloading the source
4 participants