From 0c77f506094d02d627fcc864556b1e4c132854aa Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Tue, 16 Jul 2024 14:45:35 +0200 Subject: [PATCH] Fix UnresolvedDependenciesException --- .../de/staropensource/sosengine/base/Engine.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/base/src/main/java/de/staropensource/sosengine/base/Engine.java b/base/src/main/java/de/staropensource/sosengine/base/Engine.java index 2fe08064..e84d5d8e 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/Engine.java +++ b/base/src/main/java/de/staropensource/sosengine/base/Engine.java @@ -301,8 +301,18 @@ public final class Engine implements SubsystemMainClass { for (DependencyVector vector : resolver.resolve().getOrder()) // smol workaround order.add((DependencySubsystemVector) vector); } catch (Throwable throwable) { - if (throwable instanceof UnmetDependenciesException) - ((UnmetDependenciesException) throwable).getUnmetDependencies(); + if (throwable instanceof UnmetDependenciesException exception) { + Map<@NotNull DependencyVector, @NotNull String> unmetDependencies = exception.getUnmetDependencies(); + StringBuilder list = new StringBuilder(); + + for (DependencyVector vector : unmetDependencies.keySet()) + list.append("- ") + .append(vector.getIdentifier()) + .append(": ") + .append(unmetDependencies.get(vector)); + + logger.crash("Found unresolved dependencies:" + list, throwable); + } logger.crash("An error occurred trying to resolve subsystem dependencies: " + throwable.getClass().getName() + (throwable.getMessage() == null ? "" : ": " + throwable.getMessage())); throw throwable; }