Search in sources :

Example 1 with JCacheNotFoundException

use of com.giffing.bucket4j.spring.boot.starter.exception.JCacheNotFoundException in project bucket4j-spring-boot-starter by MarcGiffing.

the class Bucket4JAutoConfigFailureAnalyzer method analyze.

@Override
protected FailureAnalysis analyze(Throwable rootFailure, Bucket4jGeneralException cause) {
    String descriptionMessage = cause.getMessage();
    String actionMessage = cause.getMessage();
    if (cause instanceof JCacheNotFoundException) {
        JCacheNotFoundException ex = (JCacheNotFoundException) cause;
        descriptionMessage = "The cache name name defined in the property is not configured in the caching provider";
        actionMessage = "Cache name: " + ex.getCacheName() + newline + "Please configure your caching provider (ehcache, hazelcast, ...)";
    }
    if (cause instanceof MissingKeyFilterExpressionException) {
        descriptionMessage = "You've set the 'filter-key-type' to 'expression' but didn't set the property 'expression'";
        actionMessage = "Please set the property 'expression' in your configuration file with a valid expression (see Spring Expression Language)" + newline;
    }
    return new FailureAnalysis(descriptionMessage, actionMessage, cause);
}
Also used : MissingKeyFilterExpressionException(com.giffing.bucket4j.spring.boot.starter.exception.MissingKeyFilterExpressionException) JCacheNotFoundException(com.giffing.bucket4j.spring.boot.starter.exception.JCacheNotFoundException) FailureAnalysis(org.springframework.boot.diagnostics.FailureAnalysis)

Aggregations

JCacheNotFoundException (com.giffing.bucket4j.spring.boot.starter.exception.JCacheNotFoundException)1 MissingKeyFilterExpressionException (com.giffing.bucket4j.spring.boot.starter.exception.MissingKeyFilterExpressionException)1 FailureAnalysis (org.springframework.boot.diagnostics.FailureAnalysis)1