use of com.walmartlabs.concord.runtime.v2.exception.InvalidFieldDefinitionException in project concord by walmartlabs.
the class YamlParserV2 method buildErrorMessage.
private static String buildErrorMessage(String fileName, YamlProcessingException e) {
String prefix = "(" + fileName + "): Error";
List<YamlProcessingException> errors = getYamlProcessingExceptionList(e);
Collections.reverse(errors);
String padding = "\t";
StringBuilder result = new StringBuilder(toMessage(prefix, errors.remove(0)));
List<InvalidFieldDefinitionException> stepErrors = errors.stream().filter(err -> err instanceof InvalidFieldDefinitionException).map(err -> (InvalidFieldDefinitionException) err).collect(Collectors.toList());
if (stepErrors.size() > 0) {
result.append("\n\t").append("while processing steps:");
}
for (InvalidFieldDefinitionException err : stepErrors) {
result.append("\n").append(padding).append("'").append(err.getFieldName()).append("'").append(" @ ").append(Location.toShortString(err.getLocation()));
padding += "\t";
}
return result.toString();
}
Aggregations