mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-05 23:07:42 -05:00
Improve error messages for method calls expecting only 1 argument
This commit is contained in:
@@ -823,7 +823,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
if (!Variant::is_utility_function_vararg(bifunc->func)) {
|
||||
int expected_args = Variant::get_utility_function_argument_count(bifunc->func);
|
||||
if (expected_args != bifunc->arguments.size()) {
|
||||
_set_error("Builtin func '" + String(bifunc->func) + "' expects " + itos(expected_args) + " arguments.");
|
||||
_set_error("Builtin func '" + String(bifunc->func) + "' expects " + itos(expected_args) + " argument(s).");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3501,9 +3501,9 @@ String Variant::get_call_error_text(Object *p_base, const StringName &p_method,
|
||||
err_text = "Cannot convert argument " + itos(errorarg + 1) + " from [missing argptr, type unknown] to " + Variant::get_type_name(Variant::Type(ce.expected));
|
||||
}
|
||||
} else if (ce.error == Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) {
|
||||
err_text = "Method expected " + itos(ce.expected) + " arguments, but called with " + itos(p_argcount);
|
||||
err_text = "Method expected " + itos(ce.expected) + " argument(s), but called with " + itos(p_argcount);
|
||||
} else if (ce.error == Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) {
|
||||
err_text = "Method expected " + itos(ce.expected) + " arguments, but called with " + itos(p_argcount);
|
||||
err_text = "Method expected " + itos(ce.expected) + " argument(s), but called with " + itos(p_argcount);
|
||||
} else if (ce.error == Callable::CallError::CALL_ERROR_INVALID_METHOD) {
|
||||
err_text = "Method not found";
|
||||
} else if (ce.error == Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL) {
|
||||
|
||||
Reference in New Issue
Block a user