diff --git a/src/main/java/org/ssssssss/script/runtime/handle/FunctionCallHandle.java b/src/main/java/org/ssssssss/script/runtime/handle/FunctionCallHandle.java index 6b186b53ac733841ef74cdf809a5342a054555a5..fb2fd44724074b7de0bd5938b377b07129208043 100644 --- a/src/main/java/org/ssssssss/script/runtime/handle/FunctionCallHandle.java +++ b/src/main/java/org/ssssssss/script/runtime/handle/FunctionCallHandle.java @@ -171,7 +171,7 @@ public class FunctionCallHandle { if (optional) { return null; } - throw new NullPointerException("target is null"); + throw new NullPointerException(String.format("Cannot read properties of null (reading '%s')", name)); } if ("class".equals(name)) { return target instanceof Class ? target : target.getClass(); @@ -310,7 +310,7 @@ public class FunctionCallHandle { public static Object set_variable_value(RuntimeContext runtimeContext, Object target, Object name, Object value) throws Throwable { if (target == null) { - throw new NullPointerException("target is null"); + throw new NullPointerException(String.format("Cannot read properties of null (reading '%s')", name)); } if (name == null) { throw new NullPointerException("key is null");