package io.polyglotted.eswrapper.services;

import com.google.common.collect.ImmutableMap;

import java.util.Map;

public class ValidityException extends IndexerException {

    protected ValidityException(ImmutableMap<String, Object> errorsMap) {
        super(errorsMap);
    }

    public static <K, V> void checkValidity(Map<K, V>  validations) {
        if (!validations.isEmpty()) {
            throw new ValidityException(ImmutableMap.of("ERROR_MESSAGE",
               buildFailureMessage("validation failed:", validations), "ERRORS", validations));
        }
    }
}

@@ -274,16 +274,241 @@
 %0A    %7D%0A%0A
+    public static void failedValidity(boolean condition, String message) %7B%0A        if (!condition) %7B%0A            throw new ValidityException(ImmutableMap.of(%22ERROR_MESSAGE%22, %22validation failed:%22 + message));%0A        %7D%0A    %7D%0A%0A
     publ
@@ -552,17 +552,16 @@
 ap%3CK, V%3E
- 
  validat

add simple validity check - fixes #50