-
Notifications
You must be signed in to change notification settings - Fork 243
convert Runtime exceptions in the CRAM code into CRAMExceptions (also… #1526
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
base: master
Are you sure you want to change the base?
Conversation
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.
@yfarjoun Most of these seem good; except for a couple. If you don't have time to finish this just let me know and I'll take it over.
@@ -73,7 +74,7 @@ public CRAMReferenceRegion(final CRAMReferenceSource cramReferenceSource, final | |||
final SAMSequenceRecord sequence = samFileHeader.getSequence(referenceIndex); | |||
referenceBases = referenceSource.getReferenceBases(sequence, true); | |||
if (referenceBases == null) { | |||
throw new IllegalArgumentException( | |||
throw new CRAMException( |
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 not sure what the original intent of CRAMException was, but starting with the CRAM rewrite I restricted it's use to internal error conditions, such as malformed input as reported in broadinstitute/picard#1624. Not all of the CRAM codebase is conforming yet, but I don't think this is a case where CRAMException makes sense, since this is a user error.
@@ -422,7 +423,7 @@ private EncodingDetails buildEncodingForTag(final List<CRAMCompressionRecord> re | |||
new ExternalByteArrayEncoding(tagID)).toEncodingDescriptor(); | |||
return details; | |||
default: | |||
throw new IllegalArgumentException("Unknown tag type: " + (char) type); | |||
throw new CRAMException("Unknown tag type: " + (char) type); |
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.
This one does seem like an appropriate case for CRAMException.
@@ -88,7 +90,7 @@ public static long writeCramEOF(final CRAMVersion cramVersion, final OutputStrea | |||
throw new RuntimeIOException(e); | |||
} | |||
|
|||
throw new IllegalArgumentException(String.format("Unrecognized CRAM version %s", cramVersion)); | |||
throw new CRAMException(String.format("Unrecognized CRAM version %s", cramVersion)); |
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.
This one is borderline, but I'd err on leaving it as IllegalArgumentException, or else RuntimeException.
… runtime)
(sorry again about the push to master)
Description
Please explain the changes you made here.
Explain the motivation for making this change. What existing problem does the pull request solve?
Things to think about before submitting: