Skip to content

Return missing component types in QueryDoesNotMatch errors #8917

@SignalWalker

Description

@SignalWalker

What problem does this solve or what need does it fill?

When handling QueryEntityError::QueryDoesNotMatch from Querys over multiple component types, it'd be useful for debugging to be able to check which components were missing.

What solution would you like?

The first that comes to mind is to just put a Vec of component names in the error type, but it doesn't have to be that -- I just want to be able to find out without having to manually check each component. Maybe a Query::get_missing function?

What alternative(s) have you considered?

  • Instead of Query<(X, Y)>, use Query<(Option<X>, Option<Y>)> -- this isn't very ergonomic, though, especially when the component isn't actually intended to be optional.

Related PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-DiagnosticsLogging, crash handling, error reporting and performance analysisA-ECSEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to use

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions