Skip to content

Commit

Permalink
Improve exception message for unset VCF output type (#1357)
Browse files Browse the repository at this point in the history
* Improve exception message for unset VCF output type

* Add valid VCF extensions and attempted outPath to exception message

* outPath can be null for streams

* Better formatting on message
  • Loading branch information
clintval authored and Yossi Farjoun committed Apr 23, 2019
1 parent 5442f78 commit 335f2c1
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
import java.nio.file.Path;
import java.util.EnumSet;

import static htsjdk.samtools.util.IOUtil.VCF_EXTENSIONS_LIST;

/*
* Created with IntelliJ IDEA.
* User: thibault
Expand Down Expand Up @@ -453,7 +455,12 @@ else if (STREAM_TYPES.contains(this.outType))

switch (typeToBuild) {
case UNSPECIFIED:
throw new IllegalArgumentException("Must specify file or stream output type.");
throw new IllegalArgumentException(
"Output format type is not set, or could not be inferred from the output path. "
+ "If a path was used, does it have a valid VCF extension ("
+ String.join(", ", VCF_EXTENSIONS_LIST)
+ ")?"
);
case VCF:
if ((refDict == null) && (options.contains(Options.INDEX_ON_THE_FLY)))
throw new IllegalArgumentException("A reference dictionary is required for creating Tribble indices on the fly");
Expand Down

0 comments on commit 335f2c1

Please sign in to comment.