Carpet

Carpet

2M Downloads

Non [a-z0-9/._-] character in argument of `entity_list` produces full `InvalidIdentifierException` error

James103 opened this issue ยท 1 comments

commented

As of Minecraft 1.17.1-rc1 and Carpet mod 1.4.42, running the command /script run entity_list('[') does return an error as expected, but it also prints the following error to the Minecraft Log:

net.minecraft.class_151: Non [a-z0-9/._-] character in path of location: minecraft:[
	at net.minecraft.class_2960.<init>(class_2960.java:41)
	at net.minecraft.class_2960.<init>(class_2960.java:46)
	at carpet.script.value.EntityValue.getEntityDescriptor(EntityValue.java:254)
	at carpet.script.api.Entities.lambda$apply$6(Entities.java:170)
	at carpet.script.api.Entities$$Lambda$5787/0x00000000d9721648.apply(Unknown Source)
	at carpet.script.Expression$16.lazyEval(Expression.java:566)
	at carpet.script.Expression.lambda$extractOp$19(Expression.java:1296)
	at carpet.script.Expression$$Lambda$7916/0x00000000fea39740.evalValue(Unknown Source)
	at carpet.script.Expression.evalValue(Expression.java:907)
	at carpet.script.Expression.eval(Expression.java:900)
	at carpet.script.CarpetExpression.scriptRunCommand(CarpetExpression.java:112)
	at carpet.commands.ScriptCommand.lambda$compute$68(ScriptCommand.java:506)
	at carpet.commands.ScriptCommand$$Lambda$7740/0x00000000f6e56cd8.get(Unknown Source)
	at carpet.commands.ScriptCommand.handleCall(ScriptCommand.java:438)
	at carpet.commands.ScriptCommand.compute(ScriptCommand.java:504)
	at carpet.commands.ScriptCommand.lambda$register$16(ScriptCommand.java:143)
	at carpet.commands.ScriptCommand$$Lambda$5879/0x00000000d972c8d0.run(Unknown Source)
	at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:263)
	at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:177)
	at net.minecraft.class_2170.method_9249(class_2170.java:251)
	at net.minecraft.class_3244.method_14370(class_3244.java:1222)
	at net.minecraft.class_3244.method_31286(class_3244.java:1206)
	at net.minecraft.class_3244.method_12048(class_3244.java:1189)
	at net.minecraft.class_2797.method_12115(class_2797.java:30)
	at net.minecraft.class_2797.method_11054(class_2797.java:7)
	at net.minecraft.class_2600.method_11072(class_2600.java:21)
	at net.minecraft.class_2600$$Lambda$7137/0x00000000d9f08158.run(Unknown Source)
	at net.minecraft.class_3738.run(class_3738.java:18)
	at net.minecraft.class_1255.method_18859(class_1255.java:151)
	at net.minecraft.class_4093.method_18859(class_4093.java:23)
	at net.minecraft.server.MinecraftServer.method_24306(MinecraftServer.java:779)
	at net.minecraft.server.MinecraftServer.method_18859(MinecraftServer.java:164)
	at net.minecraft.class_1255.method_16075(class_1255.java:125)
	at net.minecraft.server.MinecraftServer.method_20415(MinecraftServer.java:761)
	at net.minecraft.server.MinecraftServer.method_16075(MinecraftServer.java:755)
	at net.minecraft.class_1255.method_18857(class_1255.java:134)
	at net.minecraft.server.MinecraftServer.method_16208(MinecraftServer.java:740)
	at net.minecraft.server.MinecraftServer.handler$beg000$modifiedRunLoop(MinecraftServer.java:4890)
	at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:667)
	at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:270)
	at net.minecraft.server.MinecraftServer$$Lambda$6180/0x00000000d9941868.run(Unknown Source)
	at java.base/java.lang.Thread.run(Thread.java:853)

I would have expected the actual error output to be simplified a bit, whereby it says something like '[' is not a valid entity descriptor (which is what is output when you run /script run entity_list('a') for example).

commented

Might be worth adding a catch for InvalidIdentifierException to the general handler, given it can happen in a lot more places and it's always the same reason: Invalid Identifier.