Tegral
Tegral copied to clipboard
Add proper exception instead of an NPE upon unsafe initialization
Example of an exception occurring because of an unsafe exception in the constructor of a component:
Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Map.get(Object)" because the return value of "guru.zoroark.tegral.di.environment.MixedImmutableEnvironment.access$getComponents$p(guru.zoroark.tegral.di.environment.MixedImmutableEnvironment)" is null
at guru.zoroark.tegral.di.environment.MixedImmutableEnvironment$MIEInjector$getValue$1.invoke(MixedImmutableEnvironment.kt:66)
at guru.zoroark.tegral.di.DynLazy.getOrInitialize(DynLazy.kt:37)
at guru.zoroark.tegral.di.environment.MixedImmutableEnvironment$MIEInjector.getValue(MixedImmutableEnvironment.kt:65)
at org.epilink.bot.http.HttpServerImpl.getWsCfg(HttpServer.kt:38)
at org.epilink.bot.http.HttpServerImpl.<init>(HttpServer.kt:47)
... 32 more
Also, docs about the safeInjection()
failure is incorrect: unsafe injections never work now