Coverage Report - liquibase.exception.MigrationFailedException
 
Classes in this File Line Coverage Branch Coverage Complexity
MigrationFailedException
0%
0/20
0%
0/4
1.4
 
 1  
 package liquibase.exception;
 2  
 
 3  
 import liquibase.changelog.ChangeSet;
 4  
 
 5  
 public class MigrationFailedException extends LiquibaseException {
 6  
 
 7  
     private static final long serialVersionUID = 1L;
 8  
     private ChangeSet failedChangeSet;
 9  
 
 10  0
     public MigrationFailedException() {
 11  0
     }
 12  
 
 13  
     public MigrationFailedException(ChangeSet failedChangeSet, String message) {
 14  0
         super(message);
 15  0
         this.failedChangeSet = failedChangeSet;
 16  0
     }
 17  
 
 18  
     public MigrationFailedException(ChangeSet failedChangeSet, String message, Throwable cause) {
 19  0
         super(message, cause);
 20  0
         this.failedChangeSet = failedChangeSet;
 21  0
     }
 22  
 
 23  
     public MigrationFailedException(ChangeSet failedChangeSet, Throwable cause) {
 24  0
         super(cause);
 25  0
         this.failedChangeSet = failedChangeSet;
 26  0
     }
 27  
 
 28  
     @Override
 29  
     public String getMessage() {
 30  0
         String message = "Migration failed";
 31  0
         if (failedChangeSet != null) {
 32  0
             message += " for change set " + failedChangeSet.toString(false);
 33  
         }
 34  0
         message += ":\n     Reason: " + super.getMessage();
 35  0
         Throwable cause = this.getCause();
 36  0
         while (cause != null) {
 37  0
             message += ":\n          Caused By: " + cause.getMessage();
 38  0
             cause = cause.getCause();
 39  
         }
 40  
 
 41  0
         return message;
 42  
     }
 43  
 }