fix(construct): Improve error messages occuring during Tweed construction

This commit is contained in:
2025-12-14 15:04:14 +01:00
parent 1e4ee118a9
commit f5c8b1aa50

View File

@@ -41,6 +41,7 @@ public class TweedConstructFactoryImpl<T> implements TweedConstructFactory<T> {
}
private <C extends T> ConstructTarget<C> getConstructTarget(Class<C> type) {
try {
ConstructTarget<C> cachedConstructTarget = readConstructTargetFromCache(type);
if (cachedConstructTarget != null) {
return cachedConstructTarget;
@@ -48,6 +49,9 @@ public class TweedConstructFactoryImpl<T> implements TweedConstructFactory<T> {
ConstructTarget<C> constructTarget = locateConstructTarget(type);
cacheConstructTarget(type, constructTarget);
return constructTarget;
} catch (Exception e) {
throw new RuntimeException("Failed to locate construct target for " + type.getName(), e);
}
}
@Locked.Read("cachedConstructTargetsLock")