Better handling of missing imports.
Darkhax opened this issue ยท 0 comments
Feature request name
Better handling of missing imports.
Feature request description
When importing a missing import, better error info should be given. Currently if an incorrect import is used you do not get a line number, and you do not get a direct and clear reason for the error. I would recommend that the exception be caught by CraftTweaker, and a more descriptive error be thrown in place.
Feature request reason
Imports are kind of scary, adding this will make it easier for newer devs. It will also improve debugging of complex scripts.
Feature request dependencies
Nope
Additional Information
Here is an example log when I am using an import that does not exist.
[INITIALIZATION][CLIENT][ERROR] [crafttweaker | SIDE_CLIENT]: Error loading {[0:crafttweaker]: tabletest.zs}: java.lang.NullPointerException
java.lang.NullPointerException
at crafttweaker.zenscript.CrTGlobalEnvironment.error(CrTGlobalEnvironment.java:95)
at stanhebben.zenscript.expression.partial.PartialPackage.getMember(PartialPackage.java:38)
at stanhebben.zenscript.ZenParsedFile.<init>(ZenParsedFile.java:100)
at crafttweaker.runtime.CrTTweaker.loadScript(CrTTweaker.java:189)
at crafttweaker.runtime.CrTTweaker.loadScript(CrTTweaker.java:101)
at crafttweaker.mc1120.events.CommonEventHandler.registerRecipes(CommonEventHandler.java:68)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_51_CommonEventHandler_registerRecipes_Register.invoke(.dynamic)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:144)
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182)
at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:816)
at net.minecraftforge.common.crafting.CraftingHelper.loadRecipes(CraftingHelper.java:624)
at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:742)
at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:336)
at net.minecraft.client.Minecraft.init(Minecraft.java:582)
at net.minecraft.client.Minecraft.run(Minecraft.java:422)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:25)