All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.polyglotted.eswrapper.services.ValidityException Maven / Gradle / Ivy

There is a newer version: 2.4.3
Show newest version
package io.polyglotted.eswrapper.services;

import com.google.common.collect.ImmutableMap;

import java.util.Map;

public class ValidityException extends IndexerException {

    protected ValidityException(ImmutableMap errorsMap) {
        super(errorsMap);
    }

    public static void failedValidity(boolean condition, String message) {
        if (!condition) {
            throw new ValidityException(ImmutableMap.of("ERROR_MESSAGE", "validation failed:" + message));
        }
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy