Fix UnresolvedDependenciesException

This commit is contained in:
JeremyStar™ 2024-07-16 14:45:35 +02:00
parent 85bff3b14d
commit 0c77f50609
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -301,8 +301,18 @@ public final class Engine implements SubsystemMainClass {
for (DependencyVector vector : resolver.resolve().getOrder()) // smol workaround for (DependencyVector vector : resolver.resolve().getOrder()) // smol workaround
order.add((DependencySubsystemVector) vector); order.add((DependencySubsystemVector) vector);
} catch (Throwable throwable) { } catch (Throwable throwable) {
if (throwable instanceof UnmetDependenciesException) if (throwable instanceof UnmetDependenciesException exception) {
((UnmetDependenciesException) throwable).getUnmetDependencies(); 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())); logger.crash("An error occurred trying to resolve subsystem dependencies: " + throwable.getClass().getName() + (throwable.getMessage() == null ? "" : ": " + throwable.getMessage()));
throw throwable; throw throwable;
} }