Improve bootstrap checks error messages
When multiple bootstrap checks fail, it's not clear where one error message begins and the next error message ends. This commit numbers the bootstrap check error messages so they are easier to read. Relates #24548
This commit is contained in:
parent
1907c46689
commit
bf32b0c59d
|
@ -149,8 +149,10 @@ final class BootstrapChecks {
|
||||||
|
|
||||||
if (!errors.isEmpty()) {
|
if (!errors.isEmpty()) {
|
||||||
final List<String> messages = new ArrayList<>(1 + errors.size());
|
final List<String> messages = new ArrayList<>(1 + errors.size());
|
||||||
messages.add("bootstrap checks failed");
|
messages.add("[" + errors.size() + "] bootstrap checks failed");
|
||||||
messages.addAll(errors);
|
for (int i = 0; i < errors.size(); i++) {
|
||||||
|
messages.add("[" + (i + 1) + "]: " + errors.get(i));
|
||||||
|
}
|
||||||
final NodeValidationException ne = new NodeValidationException(String.join("\n", messages));
|
final NodeValidationException ne = new NodeValidationException(String.join("\n", messages));
|
||||||
errors.stream().map(IllegalStateException::new).forEach(ne::addSuppressed);
|
errors.stream().map(IllegalStateException::new).forEach(ne::addSuppressed);
|
||||||
throw ne;
|
throw ne;
|
||||||
|
|
Loading…
Reference in New Issue