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

liquibase.exception.PreconditionFailedException Maven / Gradle / Ivy

The newest version!
package liquibase.exception;

import liquibase.changelog.DatabaseChangeLog;
import liquibase.precondition.FailedPrecondition;
import liquibase.precondition.Precondition;

import java.util.ArrayList;
import java.util.List;

/**
 * Thrown when a precondition failed. This is NOT the same as a PreconditionErrorException: A failure just means that
 * the specified condition evaluated to "does not apply".
 */
public class PreconditionFailedException extends Exception {

    private static final long serialVersionUID = 1L;
    private final List failedPreconditions;

    public PreconditionFailedException(String message, DatabaseChangeLog changeLog, Precondition precondition) {
        this(new FailedPrecondition(message, changeLog, precondition), null);
    }

    public PreconditionFailedException(String message, DatabaseChangeLog changeLog, Precondition precondition, Throwable cause) {
        this(new FailedPrecondition(message, changeLog, precondition), cause);
    }

    /**
     * @deprecated Use {@link #PreconditionFailedException(FailedPrecondition, Throwable)} instead
     */
    @Deprecated
    public PreconditionFailedException(FailedPrecondition failedPrecondition) {
        super("Preconditions Failed");
        this.failedPreconditions = new ArrayList<>();
        failedPreconditions.add(failedPrecondition);
    }

    public PreconditionFailedException(FailedPrecondition failedPrecondition, Throwable cause) {
        super("Preconditions Failed", cause);
        this.failedPreconditions = new ArrayList<>();
        failedPreconditions.add(failedPrecondition);
    }

    public PreconditionFailedException(List failedPreconditions) {
        super("Preconditions Failed");
        this.failedPreconditions = failedPreconditions;
    }

    public List getFailedPreconditions() {
        return failedPreconditions;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy