liquibase.exception.MigrationFailedException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liquibase-core Show documentation
Show all versions of liquibase-core Show documentation
Liquibase is a tool for managing and executing database changes.
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;
}
}