Search in sources :

Example 1 with CustomPreconditionErrorException

use of liquibase.exception.CustomPreconditionErrorException in project libresonic by Libresonic.

the class DbmsVersionPrecondition method check.

@Override
public void check(Database database) throws CustomPreconditionFailedException, CustomPreconditionErrorException {
    try {
        int dbMajor = database.getDatabaseMajorVersion();
        int dbMinor = database.getDatabaseMinorVersion();
        if (major != null && !major.equals(dbMajor)) {
            throw new CustomPreconditionFailedException("DBMS Major Version Precondition failed: expected " + major + ", got " + dbMajor);
        }
        if (minor != null && !minor.equals(dbMinor)) {
            throw new CustomPreconditionFailedException("DBMS Minor Version Precondition failed: expected " + minor + ", got " + dbMinor);
        }
    } catch (DatabaseException e) {
        throw new CustomPreconditionErrorException(e.getMessage());
    }
}
Also used : DatabaseException(liquibase.exception.DatabaseException) CustomPreconditionFailedException(liquibase.exception.CustomPreconditionFailedException) CustomPreconditionErrorException(liquibase.exception.CustomPreconditionErrorException)

Aggregations

CustomPreconditionErrorException (liquibase.exception.CustomPreconditionErrorException)1 CustomPreconditionFailedException (liquibase.exception.CustomPreconditionFailedException)1 DatabaseException (liquibase.exception.DatabaseException)1