Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve some cryptic error messages in Node #95063

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AThousandShips
Copy link
Member

Will look for more potential cases but these are some that stuck out or were mentioned

See:

@@ -1685,13 +1685,13 @@ Node *Node::get_child(int p_index, bool p_include_internal) const {
if (p_index < 0) {
p_index += data.children_cache.size();
}
ERR_FAIL_INDEX_V(p_index, (int)data.children_cache.size(), nullptr);
ERR_FAIL_INDEX_V_MSG(p_index, (int)data.children_cache.size(), nullptr, vformat("Invalid child index: %d.", p_index));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken slightly modified from move_child, both could be improved but unsure what to add further

Copy link

@Arecher Arecher Aug 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps Failed to get_child() at index %d. The node (preferably a nodename if available), only has [data.children_cache.size()] children.

@@ -2092,7 +2092,7 @@ void Node::set_owner(Node *p_owner) {
_clean_up_owner();
}

ERR_FAIL_COND(p_owner == this);
ERR_FAIL_COND_MSG(p_owner == this, "Invalid owner. Owner cannot be self.");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest Attempted to set invalid owner (to [NodeName] if available). Owner cannot be self.
The difference is very slight, but I think using attempt indicates that although you tried, it didn't actually change the owner.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches the error blow, so leaving it for consistency

scene/main/node.cpp Outdated Show resolved Hide resolved
@AThousandShips AThousandShips force-pushed the node_error_improve branch 2 times, most recently from 8d5a569 to 77d0709 Compare September 6, 2024 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants