use of dev.hilla.exception.EndpointValidationException.ValidationErrorData in project flow by vaadin.
the class EndpointInvoker method getInvalidEndpointParametersException.
private EndpointValidationException getInvalidEndpointParametersException(String methodName, String endpointName, Map<String, String> deserializationErrors, Set<ConstraintViolation<Object>> constraintViolations) {
List<ValidationErrorData> validationErrorData = new ArrayList<>(deserializationErrors.size() + constraintViolations.size());
for (Map.Entry<String, String> deserializationError : deserializationErrors.entrySet()) {
String message = String.format("Unable to deserialize an endpoint method parameter into type '%s'", deserializationError.getValue());
validationErrorData.add(new ValidationErrorData(message, deserializationError.getKey()));
}
validationErrorData.addAll(createBeanValidationErrors(constraintViolations));
String message = String.format("Validation error in endpoint '%s' method '%s'", endpointName, methodName);
return new EndpointValidationException(message, validationErrorData);
}
Aggregations