bevyengine / bevyengine/bevy

Return missing component types in `QueryDoesNotMatch` errors

Open
#8,917 1 comment 8 reactions 0 assignees View on GitHub
A-Diagnostics A-ECS C-Usability
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
4d 8m
Merged PRs (30d)
147

Description

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

When handling `QueryEntityError::QueryDoesNotMatch` from `Query`s 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, Option)>` -- this isn't very ergonomic, though, especially when the component isn't actually intended to be optional.

## Related PRs

* #8692

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.