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:
Jason Tedor 2017-05-08 12:32:57 -04:00 committed by GitHub
parent 1907c46689
commit bf32b0c59d
1 changed files with 4 additions and 2 deletions

View File

@ -149,8 +149,10 @@ final class BootstrapChecks {
if (!errors.isEmpty()) {
final List<String> messages = new ArrayList<>(1 + errors.size());
messages.add("bootstrap checks failed");
messages.addAll(errors);
messages.add("[" + errors.size() + "] bootstrap checks failed");
for (int i = 0; i < errors.size(); i++) {
messages.add("[" + (i + 1) + "]: " + errors.get(i));
}
final NodeValidationException ne = new NodeValidationException(String.join("\n", messages));
errors.stream().map(IllegalStateException::new).forEach(ne::addSuppressed);
throw ne;