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

liquibase.exception.PreconditionErrorException Maven / Gradle / Ivy

There is a newer version: 3.6.2.5.inovus
Show newest version
package liquibase.exception;

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

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

/**
 * Thrown when a problem occurs in the evaluation of a precondition (which, under normal circumstances, should never
 * happen).
 */
public class PreconditionErrorException extends Exception {

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

    public PreconditionErrorException(String message, List erroredPreconditions) {
        super(message);
        this.erroredPreconditions = erroredPreconditions;
    }

    public PreconditionErrorException(Exception cause, DatabaseChangeLog changeLog, Precondition precondition) {
        this(new ErrorPrecondition(cause, changeLog, precondition));
    }

    public PreconditionErrorException(ErrorPrecondition errorPrecondition) {
        super("Precondition Error", errorPrecondition.getCause());
        this.erroredPreconditions = new ArrayList<>();
        erroredPreconditions.add(errorPrecondition);
    }

    public PreconditionErrorException(List errorPreconditions) {
        super("Precondition Error");
        this.erroredPreconditions = errorPreconditions;
    }

    public List getErrorPreconditions() {
        return erroredPreconditions;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy