Improved error messages -- now easier to read, points to the GATK Error Messages wiki, and avoids double printing of stack traces

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1850 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2009-10-15 12:07:44 +00:00
parent a9094c835c
commit 0c2016c19a
2 changed files with 15 additions and 13 deletions

View File

@ -99,15 +99,13 @@ public class MergingSamRecordIterator2 implements CloseableIterator<SAMRecord>,
*/
private void checkSortOrder(SAMFileReader reader) {
if (this.sortOrder != SAMFileHeader.SortOrder.unsorted && reader.getFileHeader().getSortOrder() != this.sortOrder) {
String msg = String.format("The GATK requires your bam have %s sort order, but your BAM file header %s. Continuing beyond this point is unsafe -- please update your BAM file to have a compatible sort order using samtools sort or Picard MergeBamFiles",
this.sortOrder, reader.getFileHeader().getAttribute("SO") == null ? "is missing the SO sort order flag" : "has an SO flag set to " + reader.getFileHeader().getAttribute("SO"));
if (reads.getSafetyChecking()) {
throw new PicardException("Files are not compatible with sort order: " + reader.getFileHeader().getSortOrder() +
" vrs " + this.sortOrder + ". Make sure that the SO flag in your bam file is set (The reader attribute for sort order equals "
+ reader.getFileHeader().getAttribute("SO") + " in this case).");
throw new PicardException(msg);
} else if (!warnedUserAboutSortOrder) {
warnedUserAboutSortOrder = true;
Utils.warnUser("Files are not compatible with sort order: " + reader.getFileHeader().getSortOrder() +
" vrs " + this.sortOrder + ". Make sure that the SO flag in your bam file is set (The reader attribute for sort order equals "
+ reader.getFileHeader().getAttribute("SO") + " in this case).");
Utils.warnUser(msg);
}
}

View File

@ -228,12 +228,12 @@ public abstract class CommandLineProgram {
}
}
// regardless of what happens next, generate the header information
generateHeaderInformation(clp, args);
// set the default logger level
clp.setupLoggerLevel();
// regardless of what happens next, generate the header information
generateHeaderInformation(clp, args);
// call the execute
CommandLineProgram.result = clp.execute();
@ -249,8 +249,8 @@ public abstract class CommandLineProgram {
// we catch all exceptions here. if it makes it to this level, we're in trouble. Let's bail!
// TODO: what if the logger is the exception? hmm...
logger.fatal("Exception caught by base Command Line Program, with message: " + e.getMessage());
logger.fatal("with cause: " + e.getCause());
e.printStackTrace();
if ( e.getCause() != null ) logger.fatal("with cause: " + e.getCause());
//e.printStackTrace();
throw new RuntimeException(e);
}
}
@ -338,8 +338,12 @@ public abstract class CommandLineProgram {
*/
private static void printExitSystemMsg(final String msg) {
System.out.printf("------------------------------------------------------------------------------------------%n");
System.out.printf("An error has occurred. Please check your command line arguments for any typos or inconsistencies.%n%n");
System.out.printf("For assistance, please email us at gsahelp@broad.mit.edu, or review our documentation at http://www.broadinstitute.org/gsa/wiki.%n");
System.out.printf("The following error has occurred:%n%n");
System.out.printf("%s:%n%n", msg);
System.out.printf("Please check your command line arguments for any typos or inconsistencies.%n");
System.out.printf("Help for dealing with common GATK error messages can be found at http://www.broadinstitute.org/gsa/wiki/index.php/GATK_Error_Messages%n");
System.out.printf(" Or see our general docs documentation at http://www.broadinstitute.org/gsa/wiki%n");
System.out.printf("Please email us at gsahelp@broad.mit.edu to report bugs or with help resolving undocumented issues%n");
}
/**