Skip to content

Commit

Permalink
fix(artifacts): Use client error code for multiple matching artifacts (
Browse files Browse the repository at this point in the history
…#2942)

Same fix as #2524, but for the case where multiple artifacts matches. Without this, Echo will try to trigger the pipeline five times and it will appear five times in the execution list.
  • Loading branch information
jervi authored and ezimanyi committed May 29, 2019
1 parent 8b36fcd commit c47fd19
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@
import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository;
import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository.ExecutionCriteria;
import java.io.IOException;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nonnull;
Expand Down Expand Up @@ -310,7 +318,7 @@ private Artifact matchSingleArtifact(
break;
default:
if (requireUniqueMatches) {
throw new IllegalArgumentException(
throw new InvalidRequestException(
"Expected artifact " + expectedArtifact + " matches multiple artifacts " + matches);
}
result = matches.get(0);
Expand Down

0 comments on commit c47fd19

Please sign in to comment.