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

[Merged by Bors] - More detailed errors when resource not found #1864

Closed
wants to merge 1 commit into from
Closed

[Merged by Bors] - More detailed errors when resource not found #1864

wants to merge 1 commit into from

Conversation

oldstork
Copy link

@oldstork oldstork commented Apr 10, 2021

Fixes #1846

Got scared of the other "Requested resource does not exist" error at line 395 in system_param.rs, under impl<'a, T: Component> SystemParamFetch<'a> for ResMutState<T> {. Someone with better knowledge of the code might be able to go in and improve that one.

@alice-i-cecile alice-i-cecile added C-Code-Quality A section of code that is hard to understand or change help wanted C-Usability A targeted quality-of-life change that makes Bevy easier to use A-ECS Entities, components, systems, and events labels Apr 10, 2021
@NathanSWard
Copy link
Contributor

Got scared of the other "Requested resource does not exist" error at line 395

I believe you can make the panic! message be the same as the other one you implemented. (e.g, utilizing system_state.name)

@@ -242,7 +242,8 @@ impl<'a, T: Component> SystemParamFetch<'a> for ResState<T> {
.get_populated_resource_column(state.component_id)
.unwrap_or_else(|| {
panic!(
"Requested resource does not exist: {}",
"Resource requested by {} does not exist: {}",
Copy link
Member

Choose a reason for hiding this comment

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

What do you think of "Resource {} does not exist, but was requested by {}"?

Copy link
Member

Choose a reason for hiding this comment

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

I think as written it flows a bit more naturally.

@cart
Copy link
Member

cart commented Apr 14, 2021

bors r+

bors bot pushed a commit that referenced this pull request Apr 14, 2021
Fixes #1846

Got scared of the other "Requested resource does not exist" error at line 395 in `system_param.rs`, under `impl<'a, T: Component> SystemParamFetch<'a> for ResMutState<T> {`. Someone with better knowledge of the code might be able to go in and improve that one.
@bors bors bot changed the title More detailed errors when resource not found [Merged by Bors] - More detailed errors when resource not found Apr 14, 2021
@bors bors bot closed this Apr 14, 2021
bors bot pushed a commit that referenced this pull request Apr 23, 2021
…1986)

Some panic messages for systems include the system name, but there's a few panic messages which do not. This PR adds the system name for the remaining panic messages.

This is a continuation of the work done in #1864.
Related: #1846
@oldstork oldstork deleted the resource-not-found-errors branch April 27, 2021 03:31
@DJMcNab
Copy link
Member

DJMcNab commented Jul 16, 2021

@therealstork please respond in #2373 for the relicense to MIT/Apache 2.0. Thanks!

ostwilkens pushed a commit to ostwilkens/bevy that referenced this pull request Jul 27, 2021
Fixes bevyengine#1846

Got scared of the other "Requested resource does not exist" error at line 395 in `system_param.rs`, under `impl<'a, T: Component> SystemParamFetch<'a> for ResMutState<T> {`. Someone with better knowledge of the code might be able to go in and improve that one.
ostwilkens pushed a commit to ostwilkens/bevy that referenced this pull request Jul 27, 2021
…evyengine#1986)

Some panic messages for systems include the system name, but there's a few panic messages which do not. This PR adds the system name for the remaining panic messages.

This is a continuation of the work done in bevyengine#1864.
Related: bevyengine#1846
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-Code-Quality A section of code that is hard to understand or change C-Usability A targeted quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better error messages when Resources can't be found
6 participants