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

liquibase.exception.MigrationFailedException Maven / Gradle / Ivy

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

import liquibase.changelog.ChangeSet;

public class MigrationFailedException extends LiquibaseException {

    private static final long serialVersionUID = 1L;
    private final String failedChangeSetName;
    
    public MigrationFailedException() {
        failedChangeSetName = "(unknown)";
    }

    public MigrationFailedException(ChangeSet failedChangeSet, String message) {
        super(message);
        this.failedChangeSetName = failedChangeSet.toString(false);
    }


    public MigrationFailedException(ChangeSet failedChangeSet, String message, Throwable cause) {
        super(message, cause);
        this.failedChangeSetName = failedChangeSet.toString(false);
    }

    public MigrationFailedException(ChangeSet failedChangeSet, Throwable cause) {
        super(cause);
        this.failedChangeSetName = failedChangeSet.toString(false);
    }

    @Override
    public String getMessage() {
        String message = "Migration failed";
        if (failedChangeSetName != null) {
            message += " for change set "+ failedChangeSetName;
        }
        message += ":\n     Reason: "+super.getMessage();

        return message;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy