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

IndexFeatureFile: more informative error message when trying to index a malformed file #4187

Merged

Conversation

droazen
Copy link
Contributor

@droazen droazen commented Jan 17, 2018

Resolves #4184

@droazen
Copy link
Contributor Author

droazen commented Jan 17, 2018

@ldgauthier please review

@@ -169,7 +169,7 @@ public void testVCFGZIndex_inferredName(){
checkIndex(index, Arrays.asList("1", "2", "3", "4"));
}

@Test(expectedExceptions = UserException.MalformedFile.class)
Copy link
Contributor

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?

Copy link
Contributor Author

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%...

Copy link
Member

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.

Copy link
Member

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"

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

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

Good idea!

Copy link
Contributor

Choose a reason for hiding this comment

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

I like it.

@droazen droazen force-pushed the dr_indexfeaturefile_better_error_message_on_malformed_file branch from f238f5a to 4c2d044 Compare January 17, 2018 17:18
@droazen
Copy link
Contributor Author

droazen commented Jan 17, 2018

@ldgauthier Introduced a suitably-vague UserException.CouldNotIndexFile in response to your comments. Ready for a last look.

@ldgauthier
Copy link
Contributor

👍

@codecov-io
Copy link

Codecov Report

Merging #4187 into master will decrease coverage by 0.036%.
The diff coverage is 100%.

@@              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
Impacted Files Coverage Δ Complexity Δ
...adinstitute/hellbender/tools/IndexFeatureFile.java 100% <100%> (+9.677%) 12 <5> (ø) ⬇️
...institute/hellbender/exceptions/UserException.java 70.229% <100%> (+0.698%) 3 <0> (ø) ⬇️
...tools/funcotator/dataSources/TableFuncotation.java 62.319% <0%> (-0.472%) 31% <0%> (+14%)
...er/tools/spark/sv/discovery/AlignmentInterval.java 88.889% <0%> (-0.383%) 72% <0%> (-1%)
...oadinstitute/hellbender/utils/gcs/BucketUtils.java 80% <0%> (+1.29%) 39% <0%> (ø) ⬇️
...otator/dataSources/gencode/GencodeFuncotation.java 57.505% <0%> (+1.89%) 185% <0%> (-4%) ⬇️
...itute/hellbender/tools/funcotator/Funcotation.java 36.364% <0%> (+3.03%) 5% <0%> (+2%) ⬆️
...utils/smithwaterman/SmithWatermanIntelAligner.java 80% <0%> (+30%) 3% <0%> (+2%) ⬆️

@droazen droazen merged commit 138baeb into master Jan 17, 2018
@droazen droazen deleted the dr_indexfeaturefile_better_error_message_on_malformed_file branch January 17, 2018 19:26
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.

4 participants