Thrown a more meaningful exception

This commit is contained in:
Guillaume Nodet 2024-11-25 08:05:44 +01:00
parent b367e73b50
commit ae56c9b76e
1 changed files with 2 additions and 1 deletions

View File

@ -25,6 +25,7 @@ import java.util.HashSet;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
@ -85,7 +86,7 @@ public class BuildPlan {
} }
public BuildStep requiredStep(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 // add a follow-up plan to this one