From e62d1cd3ff0bcee504e4a1896ffd07519bc4288d Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sat, 26 Sep 2020 11:35:18 +0800 Subject: [PATCH] Better error message for setter. --- src/fn_call.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/fn_call.rs b/src/fn_call.rs index 1aeaa473..eeba460a 100644 --- a/src/fn_call.rs +++ b/src/fn_call.rs @@ -288,7 +288,7 @@ impl Engine { if let Some(prop) = extract_prop_from_getter(fn_name) { return EvalAltResult::ErrorDotExpr( format!( - "Unknown property '{}' for {}, or it is write-only", + "Failed to get property '{}' of '{}' - the property may not exist, or it may be write-only", prop, self.map_type_name(args[0].type_name()) ), @@ -301,9 +301,10 @@ impl Engine { if let Some(prop) = extract_prop_from_setter(fn_name) { return EvalAltResult::ErrorDotExpr( format!( - "Unknown property '{}' for {}, or it is read-only", + "Failed to set property '{}' of '{}' - the property may not exist, may be read-only, or '{}' is the wrong type", prop, - self.map_type_name(args[0].type_name()) + self.map_type_name(args[0].type_name()), + self.map_type_name(args[1].type_name()), ), Position::none(), )