mirror of
https://github.com/bevyengine/bevy
synced 2024-11-24 21:53:07 +00:00
QueryEntityError: Use short name for components (#16032)
Use the new `disqualified` crate in `QueryEntityError` to make the error message more readable. --- ## Showcase Old: QueryDoesNotMatch(0v1 with components my_game::main::foo::A, my_game::main::foo::B, bevy_pbr::light::point_light::PointLight, bevy_render::primitives::CubemapFrusta, bevy_pbr::bundle::CubemapVisibleEntities, bevy_transform::components::transform::Transform, bevy_transform::components::global_transform::GlobalTransform, bevy_render::view::visibility::Visibility, bevy_render::view::visibility::InheritedVisibility, bevy_render::view::visibility::ViewVisibility, bevy_render::sync_world::SyncToRenderWorld) New: QueryDoesNotMatch(0v1 with components A, B, PointLight, CubemapFrusta, CubemapVisibleEntities, Transform, GlobalTransform, Visibility, InheritedVisibility, ViewVisibility, SyncToRenderWorld) --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
This commit is contained in:
parent
b0fd3d524f
commit
3eec0f0a77
1 changed files with 5 additions and 2 deletions
|
@ -70,7 +70,7 @@ fn format_archetype(
|
|||
.components()
|
||||
.get_name(component_id)
|
||||
.expect("entity does not belong to world");
|
||||
write!(f, "{name}")?;
|
||||
write!(f, "{}", disqualified::ShortName(name))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -126,6 +126,9 @@ mod test {
|
|||
.get(&world, entity)
|
||||
.unwrap_err();
|
||||
|
||||
assert_eq!(format!("{err:?}"), "QueryDoesNotMatch(0v1 with components bevy_ecs::query::error::test::query_does_not_match::Present1, bevy_ecs::query::error::test::query_does_not_match::Present2)");
|
||||
assert_eq!(
|
||||
format!("{err:?}"),
|
||||
"QueryDoesNotMatch(0v1 with components Present1, Present2)"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue