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

Raise exceptions instead of sys.exit #62

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ollyfutur
Copy link

Motivation

I got stuck for a little while on a problem with Barnaba while processing a dataset using multiprocessing. Some files caused the program to exit because no valid nucleobase was found. I did not expect this behavior which caused my program to inexplicably stall since sub-processes exited without raising an Exception that I could identify. In my case the problematic piece of code was in the Nucleic constructor. While this is quickly fixable in the caller by explicitly catching SystemExit in a try block, I suggest Barnaba should raise a ValueError to align with python error handling conventions.

Changes

  • This pattern of using sys.stderr.write + sys.exit is found in many places in the code. I have replaced these occurrences with ValueErrors in the parts that can be used as modules (aka everywhere except in commandline.py)

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