From 17f42e8e66f5c8bb4fd66097a9da38f80340bc04 Mon Sep 17 00:00:00 2001 From: lawnjelly Date: Tue, 20 Sep 2022 08:10:08 +0100 Subject: [PATCH] Improve signal already connected error message The signal already connected message is improved to provide the names of the objects involved. --- core/object.cpp | 4 +++- scene/main/node.cpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/object.cpp b/core/object.cpp index 84698cb13b4..38f0c63b4a9 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1477,7 +1477,9 @@ Error Object::connect(const StringName &p_signal, Object *p_to_object, const Str s->slot_map[target].reference_count++; return OK; } else { - ERR_FAIL_V_MSG(ERR_INVALID_PARAMETER, "Signal '" + p_signal + "' is already connected to given method '" + p_to_method + "' in that object."); + ERR_FAIL_V_MSG(ERR_INVALID_PARAMETER, + vformat("Signal \"%s\" from \"%s\" is already connected to given method \"%s\" in \"%s\".", + p_signal, to_string(), p_to_method, p_to_object->to_string())); } } diff --git a/scene/main/node.cpp b/scene/main/node.cpp index f9d87570086..3eba385598d 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2126,6 +2126,8 @@ void Node::get_storable_properties(Set &r_storable_properties) const } String Node::to_string() { + // This code doesn't print the script's name, it calls to_string() if you override it in a Node's script, + // which you only do if you specifically want to customize how the node should be represented by print(). if (get_script_instance()) { bool valid; String ret = get_script_instance()->to_string(&valid);