Skip to content

Commit

Permalink
Improved error reporting (#100)
Browse files Browse the repository at this point in the history
* Improved error reporting

* style fix
  • Loading branch information
BrunoCarrier authored Jan 30, 2018
1 parent deb4b1e commit bbaa2b1
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -330,12 +331,15 @@ private List<AmazonCredentials> getEcsCredentials() {
}

private AmazonCredentials getEcsCredentials(String account) {
return getEcsCredentials().stream()
.filter(credentials -> credentials.getName().equals(account))
.findFirst().get();
try {
return getEcsCredentials().stream()
.filter(credentials -> credentials.getName().equals(account))
.findFirst().get();
} catch (NoSuchElementException exception) {
throw new NoSuchElementException(String.format("There is no ECS account by the name of '%s'", account));
}
}


@Override
public Map<String, Set<EcsServerCluster>> getClusterSummaries(String application) {
return getClusters();
Expand Down

0 comments on commit bbaa2b1

Please sign in to comment.