Missing file are user errors.

This commit is contained in:
Eric Banks 2012-10-12 09:48:12 -04:00
parent fa77a83783
commit 81532a0529
2 changed files with 8 additions and 0 deletions

View File

@ -34,8 +34,10 @@ import org.broadinstitute.sting.gatk.refdata.utils.RMDTriplet;
import org.broadinstitute.sting.utils.GenomeLoc; import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser; import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException; import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.exceptions.UserException;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.List; import java.util.List;
@ -239,6 +241,8 @@ class ReferenceOrderedQueryDataPool extends ResourcePool<RMDTrack,LocationAwareS
} else { } else {
return new SeekableRODIterator(header,sequenceDictionary,referenceSequenceDictionary,genomeLocParser,track.getIterator()); return new SeekableRODIterator(header,sequenceDictionary,referenceSequenceDictionary,genomeLocParser,track.getIterator());
} }
} catch (FileNotFoundException e) {
throw new UserException.CouldNotReadInputFile(fileDescriptor.getName(), "it could not be found");
} catch (IOException e) { } catch (IOException e) {
throw new ReviewedStingException("Unable to create iterator for rod named " + fileDescriptor.getName(),e); throw new ReviewedStingException("Unable to create iterator for rod named " + fileDescriptor.getName(),e);
} }

View File

@ -166,6 +166,10 @@ public class UserException extends ReviewedStingException {
super(String.format("Couldn't read file %s because %s", file.getAbsolutePath(), message)); super(String.format("Couldn't read file %s because %s", file.getAbsolutePath(), message));
} }
public CouldNotReadInputFile(String file, String message) {
super(String.format("Couldn't read file %s because %s", file, message));
}
public CouldNotReadInputFile(File file, String message, Exception e) { public CouldNotReadInputFile(File file, String message, Exception e) {
super(String.format("Couldn't read file %s because %s with exception %s", file.getAbsolutePath(), message, getMessage(e))); super(String.format("Couldn't read file %s because %s with exception %s", file.getAbsolutePath(), message, getMessage(e)));
} }