use of com.walmartlabs.concord.runtime.v2.exception.YamlProcessingException 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();
}
use of com.walmartlabs.concord.runtime.v2.exception.YamlProcessingException in project concord by walmartlabs.
the class YamlDeserializersV2 method toException.
private static YamlProcessingException toException(Result.Failure<Atom, ?> f, JsonParser p, List<Atom> atoms) {
Location loc = null;
String got = "n/a";
int pos = f.getPosition();
if (pos >= 0) {
Atom a = atoms.get(f.getPosition());
loc = a.location;
got = a.name;
}
return new YamlProcessingException(loc, "Expected: " + f.getMessage() + ". Got '" + got + "'");
}
Aggregations