Skip to content

List components for QueryEntityError::QueryDoesNotMatch#15435

Merged
alice-i-cecile merged 4 commits intobevyengine:mainfrom
SpecificProtagonist:helpful-querydoesnotmatch
Sep 26, 2024
Merged

List components for QueryEntityError::QueryDoesNotMatch#15435
alice-i-cecile merged 4 commits intobevyengine:mainfrom
SpecificProtagonist:helpful-querydoesnotmatch

Conversation

@SpecificProtagonist
Copy link
Copy Markdown
Contributor

@SpecificProtagonist SpecificProtagonist commented Sep 25, 2024

Objective

Make it easier to debug why an entity doesn't match a query.

Solution

List the entities components in QueryEntityError::QueryDoesNotMatch's message, e.g. The query does not match the entity 0v1, which has components foo::Bar, foo::Baz.
This covers most cases as expected components are typically known and filtering for change detection is rare when assessing a query by entity id.

Testing

Added a test confirming the new message matches the entity's components.

Migration Guide

  • QueryEntityError now has a lifetime. Convert it to a custom error if you need to store it.

Copy link
Copy Markdown
Contributor

@atornity atornity left a comment

Choose a reason for hiding this comment

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

LGTM, seems super useful

Copy link
Copy Markdown
Contributor

@BenjaminBrienen BenjaminBrienen left a comment

Choose a reason for hiding this comment

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

My questions have been answered. Great idea, thanks!

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Sep 26, 2024
Co-authored-by: poopy <gonesbird@gmail.com>
@alice-i-cecile alice-i-cecile added M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide M-Release-Note Work that should be called out in the blog due to impact labels Sep 26, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Sep 26, 2024
Merged via the queue into bevyengine:main with commit 5e6b141 Sep 26, 2024
@alice-i-cecile
Copy link
Copy Markdown
Member

Thank you to everyone involved with the authoring or reviewing of this PR! This work is relatively important and needs release notes! Head over to bevyengine/bevy-website#1697 if you'd like to help out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide M-Release-Note Work that should be called out in the blog due to impact S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants