}
protected Dataset getDataset(Genomics genomics, String datasetId, boolean handleException)
throws IOException {
try {
Dataset dataset = genomics.datasets().get(datasetId).execute();
addDatasetToHistory(dataset);
return dataset;
} catch (GoogleJsonResponseException e) {
if (!handleException) {
throw e;
}
String message = e.getDetails() == null ? "unknown failure" : e.getDetails().getMessage();
System.out.println("That datasetId won't work: " + message + "\n");
Map<String, String> previousDatasets = getPreviousDatasets();
if (previousDatasets.isEmpty()) {
System.out.println("There aren't any recently used datasets, " +
"if you want to make a new one try the 'createdataset' command.");
System.out.println("You can also try the public 1000 Genomes dataset ID: 10473108253681171589");
} else {
System.out.println("In the past, you've used these datasets: ");
for (Map.Entry<String, String> dataset : previousDatasets.entrySet()) {
System.out.println(dataset.getKey() + ": " + dataset.getValue());
}
}
// TODO: This call won't do what we want right now
// ListDatasetsResponse allDatasets = genomics.datasets().list().execute();