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

Print error messages on stderr consistently #8

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

wm75
Copy link

@wm75 wm75 commented Jul 1, 2020

No description provided.

@wm75
Copy link
Author

wm75 commented Jul 1, 2020

In general, I wouldn't handle errors that way (printing and exiting), but rather raise a custom Python exception.
This way you'd keep the traceback, which is so much better for fixing bugs and diagnosing user bug reports!

@@ -575,23 +580,35 @@ def genome_mode(reference, reads, start, end, compress, para, tab):
try:
start = int(start)-1
end = int(end)
except Exception:
print('User Error: invalid start/end coordinate(s)')
except ValueError:
Copy link
Author

Choose a reason for hiding this comment

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

Also note that the try/except won't catch negative values, if that's the intention.

@lgtm-com
Copy link

lgtm-com bot commented Jul 1, 2020

This pull request introduces 1 alert and fixes 2 when merging 77e91e7 into 52fd2a1 - view on LGTM.com

new alerts:

  • 1 for Syntax error

fixed alerts:

  • 2 for Unreachable code

@@ -561,7 +563,10 @@ def check_tab(tab):
if int(tab) in [1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15, 16, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33]:
Copy link
Author

Choose a reason for hiding this comment

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

use a range here!

Copy link
Author

Choose a reason for hiding this comment

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

and do the int conversion outside of the function to avoid the duplicated action

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