diff --git a/tweed5/construct/src/main/java/de/siphalor/tweed5/construct/impl/TweedConstructFactoryImpl.java b/tweed5/construct/src/main/java/de/siphalor/tweed5/construct/impl/TweedConstructFactoryImpl.java index 4247909..c6179fd 100644 --- a/tweed5/construct/src/main/java/de/siphalor/tweed5/construct/impl/TweedConstructFactoryImpl.java +++ b/tweed5/construct/src/main/java/de/siphalor/tweed5/construct/impl/TweedConstructFactoryImpl.java @@ -41,13 +41,17 @@ public class TweedConstructFactoryImpl implements TweedConstructFactory { } private ConstructTarget getConstructTarget(Class type) { - ConstructTarget cachedConstructTarget = readConstructTargetFromCache(type); - if (cachedConstructTarget != null) { - return cachedConstructTarget; + try { + ConstructTarget cachedConstructTarget = readConstructTargetFromCache(type); + if (cachedConstructTarget != null) { + return cachedConstructTarget; + } + ConstructTarget constructTarget = locateConstructTarget(type); + cacheConstructTarget(type, constructTarget); + return constructTarget; + } catch (Exception e) { + throw new RuntimeException("Failed to locate construct target for " + type.getName(), e); } - ConstructTarget constructTarget = locateConstructTarget(type); - cacheConstructTarget(type, constructTarget); - return constructTarget; } @Locked.Read("cachedConstructTargetsLock")