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

net.nemerosa.ontrack.model.support.ConfigurationValidationException Maven / Gradle / Ivy

There is a newer version: 4.4.5
Show newest version
package net.nemerosa.ontrack.model.support;

import net.nemerosa.ontrack.model.exceptions.InputException;
import net.nemerosa.ontrack.model.support.Configuration;
import org.apache.commons.lang3.StringUtils;

/**
 * Thrown when a validation error occurs when creating or updating a configuration.
 */
public class ConfigurationValidationException extends InputException {
    public ConfigurationValidationException(Configuration configuration, String message) {
        super(extractMessage(configuration, message));
    }

    private static String extractMessage(Configuration configuration, String message) {
        if (StringUtils.isNotBlank(message)) {
            return message;
        } else {
            return String.format("Cannot connect to %s", configuration.getName());
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy