OutOfMemory exceptions are User Errors

This commit is contained in:
Eric Banks 2012-04-02 22:46:56 -04:00
parent 659b82e74d
commit f6aa95685d
2 changed files with 9 additions and 2 deletions

View File

@ -100,10 +100,11 @@ public class CommandLineGATK extends CommandLineExecutable {
} catch(PicardException e) {
// TODO: Should Picard exceptions be, in general, UserExceptions or ReviewedStingExceptions?
exitSystemWithError(e);
}
catch (SAMException e) {
} catch (SAMException e) {
checkForTooManyOpenFilesProblem(e.getMessage());
exitSystemWithSamError(e);
} catch (OutOfMemoryError e) {
exitSystemWithUserError(new UserException.NotEnoughMemory());
} catch (Throwable t) {
checkForTooManyOpenFilesProblem(t.getMessage());
exitSystemWithError(t);

View File

@ -107,6 +107,12 @@ public class UserException extends ReviewedStingException {
}
}
public static class NotEnoughMemory extends UserException {
public NotEnoughMemory() {
super(String.format("There was a failure because you did not provide enough memory to run this program. See the -Xmx JVM argument to adjust the maximum heap size provided to Java"));
}
}
public static class ErrorWritingBamFile extends UserException {
public ErrorWritingBamFile(String message) {
super(String.format("An error occurred when trying to write the BAM file. Usually this happens when there is not enough space in the directory to which the data is being written (generally the temp directory) or when your system's open file handle limit is too small. To tell Java to use a bigger/better file system use -Djava.io.tmpdir=X on the command line. The exact error was %s", message));