Validation fallback values, tests and fixes

This commit is contained in:
2024-06-10 00:28:26 +02:00
parent d785389fee
commit a8e89aaee8
9 changed files with 310 additions and 7 deletions

View File

@@ -98,7 +98,11 @@ public class DefaultMiddlewareContainer<M> implements MiddlewareContainer<M> {
.filter(Objects::nonNull)
.collect(Collectors.toList());
} catch (AcyclicGraphSorter.GraphCycleException e) {
throw new IllegalStateException(e);
StringBuilder messageBuilder = new StringBuilder("Found cycle in middleware dependencies: ");
e.cycleIndeces().forEach(index -> messageBuilder.append(allMentionedMiddlewareIds[index]).append(" -> "));
messageBuilder.append(allMentionedMiddlewareIds[e.cycleIndeces().iterator().next()]);
throw new IllegalStateException(messageBuilder.toString(), e);
}
}