Skip to content

Commit

Permalink
Improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
NGSpace committed Nov 18, 2024
1 parent b643a97 commit 1089249
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class JavaScriptEngine implements IScriptingLanguageEngine {
ScriptableObject scope;
public JavaScriptEngine() {
cx = Context.enter();
cx.setLanguageVersion(Context.VERSION_ES6);//For some reason this is not the default
cx.setLanguageVersion(Context.VERSION_ES6);//Beta features
cx.setOptimizationLevel(9);

scope = cx.initSafeStandardObjects();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import io.github.ngspace.hudder.util.ObjectWrapper;
import net.minecraft.client.MinecraftClient;
import net.minecraft.component.ComponentMap;
import net.minecraft.component.ComponentType;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ protected V2ClassPropertyCall(int line, int charpos, String v, AV2Compiler c, V2

Object objValue = classobj.get();
if (objValue==null)
throw new CompileException("Can't read \""+funcName+fieldName+"\" because " + classobj.value
throw new CompileException("Can't read \"" + funcName+fieldName + "\" because " + classobj.value
+ " is null", line, charpos);
Class<?> objClass = objValue.getClass();

if (objClass.isPrimitive())
throw new CompileException("Can not read properties of primitive types (Numbers, Booleans and Chars)",line,charpos);
throw new CompileException("Can not read properties of Numbers, Booleans and Chars : "+classobj.value,line,charpos);

if (isFunctionCall) {
Object[] parameters = new Object[functionCallArgs.length];
Expand Down

0 comments on commit 1089249

Please sign in to comment.