summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_vm.cpp
diff options
context:
space:
mode:
authorDanil Alexeev <danil@alexeev.xyz>2023-06-30 20:40:02 +0300
committerDanil Alexeev <danil@alexeev.xyz>2023-10-16 14:09:57 +0300
commit0c2202c56e4c87c53dde17b35c8677974985ae81 (patch)
treefe7f07a9f165790d48493cbc5d922051c49c50c3 /modules/gdscript/gdscript_vm.cpp
parenta574c0296b38d5f786f249b12e6251e562c528cc (diff)
downloadredot-engine-0c2202c56e4c87c53dde17b35c8677974985ae81.tar.gz
GDScript: Fix incorrect error message for utility functions
Diffstat (limited to 'modules/gdscript/gdscript_vm.cpp')
-rw-r--r--modules/gdscript/gdscript_vm.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp
index 75dc2e4f8b..b723ecc185 100644
--- a/modules/gdscript/gdscript_vm.cpp
+++ b/modules/gdscript/gdscript_vm.cpp
@@ -2067,11 +2067,11 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
#ifdef DEBUG_ENABLED
if (err.error != Callable::CallError::CALL_OK) {
String methodstr = function;
- if (dst->get_type() == Variant::STRING) {
+ if (dst->get_type() == Variant::STRING && !dst->operator String().is_empty()) {
// Call provided error string.
- err_text = "Error calling utility function '" + methodstr + "': " + String(*dst);
+ err_text = vformat(R"*(Error calling utility function "%s()": %s)*", methodstr, *dst);
} else {
- err_text = _get_call_error(err, "utility function '" + methodstr + "'", (const Variant **)argptrs);
+ err_text = _get_call_error(err, vformat(R"*(utility function "%s()")*", methodstr), (const Variant **)argptrs);
}
OPCODE_BREAK;
}
@@ -2123,13 +2123,12 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
#ifdef DEBUG_ENABLED
if (err.error != Callable::CallError::CALL_OK) {
- // TODO: Add this information in debug.
- String methodstr = "<unknown function>";
- if (dst->get_type() == Variant::STRING) {
+ String methodstr = gds_utilities_names[_code_ptr[ip + 2]];
+ if (dst->get_type() == Variant::STRING && !dst->operator String().is_empty()) {
// Call provided error string.
- err_text = "Error calling GDScript utility function '" + methodstr + "': " + String(*dst);
+ err_text = vformat(R"*(Error calling GDScript utility function "%s()": %s)*", methodstr, *dst);
} else {
- err_text = _get_call_error(err, "GDScript utility function '" + methodstr + "'", (const Variant **)argptrs);
+ err_text = _get_call_error(err, vformat(R"*(GDScript utility function "%s()")*", methodstr), (const Variant **)argptrs);
}
OPCODE_BREAK;
}