diff --git a/mangooio-core/src/main/java/io/mangoo/cache/CacheProvider.java b/mangooio-core/src/main/java/io/mangoo/cache/CacheProvider.java index 668892311a..fb0e5f8f97 100644 --- a/mangooio-core/src/main/java/io/mangoo/cache/CacheProvider.java +++ b/mangooio-core/src/main/java/io/mangoo/cache/CacheProvider.java @@ -14,6 +14,7 @@ import io.mangoo.enums.CacheType; import io.mangoo.enums.Default; import io.mangoo.enums.Key; +import io.mangoo.exceptions.MangooCacheException; import io.mangoo.interfaces.MangooCache; /** @@ -44,15 +45,15 @@ public CacheProvider(Config config, Injector injector) { } private Class getCache(CacheType cacheType) { - Class mangooCache; + Class cache; try { - mangooCache = Class.forName(cacheType.getClassName()).asSubclass(MangooCache.class); - LOG.info("Using {} as implementation for Cache.", mangooCache); + cache = Class.forName(cacheType.getClassName()).asSubclass(MangooCache.class); + LOG.info("Using {} as implementation for Cache.", cache); } catch (ClassNotFoundException | ClassCastException e) { - throw new RuntimeException("Failed to initialize cache implementation", e); + throw new MangooCacheException("Failed to initialize cache implementation", e); } - return mangooCache; + return cache; } @Override diff --git a/mangooio-core/src/main/java/io/mangoo/exceptions/MangooCacheException.java b/mangooio-core/src/main/java/io/mangoo/exceptions/MangooCacheException.java new file mode 100644 index 0000000000..7bed0ffe42 --- /dev/null +++ b/mangooio-core/src/main/java/io/mangoo/exceptions/MangooCacheException.java @@ -0,0 +1,14 @@ +package io.mangoo.exceptions; + +/** + * + * @author svenkubiak + * + */ +public class MangooCacheException extends RuntimeException { + private static final long serialVersionUID = -4928845472170479321L; + + public MangooCacheException(String message, Exception e){ + super(message, e); + } +} \ No newline at end of file