Skip to content

Commit

Permalink
Thrown a more meaningful exception
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Nov 25, 2024
1 parent b367e73 commit ae56c9b
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
Expand Down Expand Up @@ -85,7 +86,7 @@ public Optional<BuildStep> step(MavenProject project, String name) {
}

public BuildStep requiredStep(MavenProject project, String name) {
return step(project, name).get();
return step(project, name).orElseThrow(() -> new NoSuchElementException("Step " + name + " not found"));
}

// add a follow-up plan to this one
Expand Down

0 comments on commit ae56c9b

Please sign in to comment.