diff options
Diffstat (limited to 'core/variant')
-rw-r--r-- | core/variant/array.cpp | 14 | ||||
-rw-r--r-- | core/variant/container_type_validate.h | 10 | ||||
-rw-r--r-- | core/variant/variant_construct.cpp | 2 | ||||
-rw-r--r-- | core/variant/variant_utility.cpp | 2 |
4 files changed, 14 insertions, 14 deletions
diff --git a/core/variant/array.cpp b/core/variant/array.cpp index 3e62d3dffa..f7a86b8fa3 100644 --- a/core/variant/array.cpp +++ b/core/variant/array.cpp @@ -385,7 +385,7 @@ int Array::find_custom(const Callable &p_callable, int p_from) const { Callable::CallError ce; p_callable.callp(argptrs, 1, res, ce); if (unlikely(ce.error != Callable::CallError::CALL_OK)) { - ERR_FAIL_V_MSG(ret, "Error calling method from 'find_custom': " + Variant::get_callable_error_text(p_callable, argptrs, 1, ce)); + ERR_FAIL_V_MSG(ret, vformat("Error calling method from 'find_custom': %s.", Variant::get_callable_error_text(p_callable, argptrs, 1, ce))); } ERR_FAIL_COND_V_MSG(res.get_type() != Variant::Type::BOOL, ret, "Error on method from 'find_custom': Return type of callable must be boolean."); @@ -445,7 +445,7 @@ int Array::rfind_custom(const Callable &p_callable, int p_from) const { Callable::CallError ce; p_callable.callp(argptrs, 1, res, ce); if (unlikely(ce.error != Callable::CallError::CALL_OK)) { - ERR_FAIL_V_MSG(-1, "Error calling method from 'rfind_custom': " + Variant::get_callable_error_text(p_callable, argptrs, 1, ce)); + ERR_FAIL_V_MSG(-1, vformat("Error calling method from 'rfind_custom': %s.", Variant::get_callable_error_text(p_callable, argptrs, 1, ce))); } ERR_FAIL_COND_V_MSG(res.get_type() != Variant::Type::BOOL, -1, "Error on method from 'rfind_custom': Return type of callable must be boolean."); @@ -574,7 +574,7 @@ Array Array::filter(const Callable &p_callable) const { Callable::CallError ce; p_callable.callp(argptrs, 1, result, ce); if (ce.error != Callable::CallError::CALL_OK) { - ERR_FAIL_V_MSG(Array(), "Error calling method from 'filter': " + Variant::get_callable_error_text(p_callable, argptrs, 1, ce)); + ERR_FAIL_V_MSG(Array(), vformat("Error calling method from 'filter': %s.", Variant::get_callable_error_text(p_callable, argptrs, 1, ce))); } if (result.operator bool()) { @@ -600,7 +600,7 @@ Array Array::map(const Callable &p_callable) const { Callable::CallError ce; p_callable.callp(argptrs, 1, result, ce); if (ce.error != Callable::CallError::CALL_OK) { - ERR_FAIL_V_MSG(Array(), "Error calling method from 'map': " + Variant::get_callable_error_text(p_callable, argptrs, 1, ce)); + ERR_FAIL_V_MSG(Array(), vformat("Error calling method from 'map': %s.", Variant::get_callable_error_text(p_callable, argptrs, 1, ce))); } new_arr[i] = result; @@ -626,7 +626,7 @@ Variant Array::reduce(const Callable &p_callable, const Variant &p_accum) const Callable::CallError ce; p_callable.callp(argptrs, 2, result, ce); if (ce.error != Callable::CallError::CALL_OK) { - ERR_FAIL_V_MSG(Variant(), "Error calling method from 'reduce': " + Variant::get_callable_error_text(p_callable, argptrs, 2, ce)); + ERR_FAIL_V_MSG(Variant(), vformat("Error calling method from 'reduce': %s.", Variant::get_callable_error_text(p_callable, argptrs, 2, ce))); } ret = result; } @@ -643,7 +643,7 @@ bool Array::any(const Callable &p_callable) const { Callable::CallError ce; p_callable.callp(argptrs, 1, result, ce); if (ce.error != Callable::CallError::CALL_OK) { - ERR_FAIL_V_MSG(false, "Error calling method from 'any': " + Variant::get_callable_error_text(p_callable, argptrs, 1, ce)); + ERR_FAIL_V_MSG(false, vformat("Error calling method from 'any': %s.", Variant::get_callable_error_text(p_callable, argptrs, 1, ce))); } if (result.operator bool()) { @@ -665,7 +665,7 @@ bool Array::all(const Callable &p_callable) const { Callable::CallError ce; p_callable.callp(argptrs, 1, result, ce); if (ce.error != Callable::CallError::CALL_OK) { - ERR_FAIL_V_MSG(false, "Error calling method from 'all': " + Variant::get_callable_error_text(p_callable, argptrs, 1, ce)); + ERR_FAIL_V_MSG(false, vformat("Error calling method from 'all': %s.", Variant::get_callable_error_text(p_callable, argptrs, 1, ce))); } if (!(result.operator bool())) { diff --git a/core/variant/container_type_validate.h b/core/variant/container_type_validate.h index 0a23c69cb4..8971fadf73 100644 --- a/core/variant/container_type_validate.h +++ b/core/variant/container_type_validate.h @@ -94,7 +94,7 @@ struct ContainerTypeValidate { return true; } - ERR_FAIL_V_MSG(false, "Attempted to " + String(p_operation) + " a variable of type '" + Variant::get_type_name(inout_variant.get_type()) + "' into a " + where + " of type '" + Variant::get_type_name(type) + "'."); + ERR_FAIL_V_MSG(false, vformat("Attempted to %s a variable of type '%s' into a %s of type '%s'.", String(p_operation), Variant::get_type_name(inout_variant.get_type()), where, Variant::get_type_name(type))); } if (type != Variant::OBJECT) { @@ -113,7 +113,7 @@ struct ContainerTypeValidate { return true; // This is fine, it's null. } Object *object = ObjectDB::get_instance(object_id); - ERR_FAIL_NULL_V_MSG(object, false, "Attempted to " + String(p_operation) + " an invalid (previously freed?) object instance into a '" + String(where) + "."); + ERR_FAIL_NULL_V_MSG(object, false, vformat("Attempted to %s an invalid (previously freed?) object instance into a '%s'.", String(p_operation), String(where))); #else Object *object = p_variant; if (object == nullptr) { @@ -126,7 +126,7 @@ struct ContainerTypeValidate { StringName obj_class = object->get_class_name(); if (obj_class != class_name) { - ERR_FAIL_COND_V_MSG(!ClassDB::is_parent_class(object->get_class_name(), class_name), false, "Attempted to " + String(p_operation) + " an object of type '" + object->get_class() + "' into a " + where + ", which does not inherit from '" + String(class_name) + "'."); + ERR_FAIL_COND_V_MSG(!ClassDB::is_parent_class(object->get_class_name(), class_name), false, vformat("Attempted to %s an object of type '%s' into a %s, which does not inherit from '%s'.", String(p_operation), object->get_class(), where, String(class_name))); } if (script.is_null()) { @@ -136,8 +136,8 @@ struct ContainerTypeValidate { Ref<Script> other_script = object->get_script(); // Check base script.. - ERR_FAIL_COND_V_MSG(other_script.is_null(), false, "Attempted to " + String(p_operation) + " an object into a " + String(where) + ", that does not inherit from '" + String(script->get_class_name()) + "'."); - ERR_FAIL_COND_V_MSG(!other_script->inherits_script(script), false, "Attempted to " + String(p_operation) + " an object into a " + String(where) + ", that does not inherit from '" + String(script->get_class_name()) + "'."); + ERR_FAIL_COND_V_MSG(other_script.is_null(), false, vformat("Attempted to %s an object into a %s, that does not inherit from '%s'.", String(p_operation), String(where), String(script->get_class_name()))); + ERR_FAIL_COND_V_MSG(!other_script->inherits_script(script), false, vformat("Attempted to %s an object into a %s, that does not inherit from '%s'.", String(p_operation), String(where), String(script->get_class_name()))); return true; } diff --git a/core/variant/variant_construct.cpp b/core/variant/variant_construct.cpp index 6c37d5e4b7..9706457549 100644 --- a/core/variant/variant_construct.cpp +++ b/core/variant/variant_construct.cpp @@ -43,7 +43,7 @@ static LocalVector<VariantConstructData> construct_data[Variant::VARIANT_MAX]; template <typename T> static void add_constructor(const Vector<String> &arg_names) { - ERR_FAIL_COND_MSG(arg_names.size() != T::get_argument_count(), "Argument names size mismatch for " + Variant::get_type_name(T::get_base_type()) + "."); + ERR_FAIL_COND_MSG(arg_names.size() != T::get_argument_count(), vformat("Argument names size mismatch for '%s'.", Variant::get_type_name(T::get_base_type()))); VariantConstructData cd; cd.construct = T::construct; diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp index 384fe6c4a6..50932afbb6 100644 --- a/core/variant/variant_utility.cpp +++ b/core/variant/variant_utility.cpp @@ -1671,7 +1671,7 @@ static void register_utility_function(const String &p_name, const Vector<String> bfi.argnames = argnames; bfi.argcount = T::get_argument_count(); if (!bfi.is_vararg) { - ERR_FAIL_COND_MSG(argnames.size() != bfi.argcount, "wrong number of arguments binding utility function: " + name); + ERR_FAIL_COND_MSG(argnames.size() != bfi.argcount, vformat("Wrong number of arguments binding utility function: '%s'.", name)); } bfi.get_arg_type = T::get_argument_type; bfi.return_type = T::get_return_type(); |