-
Notifications
You must be signed in to change notification settings - Fork 593
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
IndexFeatureFile: more informative error message when trying to index a malformed file #4187
IndexFeatureFile: more informative error message when trying to index a malformed file #4187
Conversation
@ldgauthier please review |
@@ -169,7 +169,7 @@ public void testVCFGZIndex_inferredName(){ | |||
checkIndex(index, Arrays.asList("1", "2", "3", "4")); | |||
} | |||
|
|||
@Test(expectedExceptions = UserException.MalformedFile.class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lbergelson and I have lamented how many of our tests expect non-subclassed UserExceptions and then get called with missing input files and everything passes. I'd be happier if IndexFeatureFile threw a more specific UserException, but I understand you're lumping together a few different cases. Maybe add a UserException.TribbleParseError or something similarly named?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately the underlying cause here can be anything from "file is malformed" to "codec does not support tabix", and it all comes out of htsjdk as a TribbleException
. I thought about using UserException.MalformedFile
here, which will be accurate 90%+ of the time, but there is that other 10%...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Over time every test that catches raw UserException breaks and starts to pass incorrectly due to changes in the command line inputs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's hard when all we know is "Something is wrong"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I can switch to UserException.MalformedFile
all the same, if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing htsjdk errors would be a nice benefit of redoing things in htsjdk, although it's going to be a big undertaking I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about I introduce a UserException.FailureToIndexFile
exception here -- that would be accurate and address your concerns about tests erroneously passing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually more in favor of throwing the more general exception with the exposure of the underlying issue. It's just nasty for testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it.
… a malformed file Resolves #4184
f238f5a
to
4c2d044
Compare
@ldgauthier Introduced a suitably-vague |
👍 |
Codecov Report
@@ Coverage Diff @@
## master #4187 +/- ##
==============================================
- Coverage 78.45% 78.414% -0.036%
- Complexity 16636 16649 +13
==============================================
Files 1058 1058
Lines 59759 59928 +169
Branches 9746 9786 +40
==============================================
+ Hits 46881 46992 +111
- Misses 9101 9151 +50
- Partials 3777 3785 +8
|
Resolves #4184