Replace unwraps with expects in bevy_pbr#4046
Replace unwraps with expects in bevy_pbr#4046omarbassam88 wants to merge 14 commits intobevyengine:mainfrom
Conversation
|
Something went wrong here. You have two commits ( |
3d33632 to
5164bbe
Compare
5164bbe to
cd070ad
Compare
I did fix it now. Sorry, this is my first pull request. |
Perfect, thanks! Don't worry about it it's all good :) |
|
Good stuff by the way! I'm just clarifying some of the error messages a little. :) |
Co-authored-by: Robert Swain <robert.swain@gmail.com>
Co-authored-by: Robert Swain <robert.swain@gmail.com>
Co-authored-by: Robert Swain <robert.swain@gmail.com>
Co-authored-by: Robert Swain <robert.swain@gmail.com>
Co-authored-by: Robert Swain <robert.swain@gmail.com>
Co-authored-by: Robert Swain <robert.swain@gmail.com>
Co-authored-by: Robert Swain <robert.swain@gmail.com>
Co-authored-by: Robert Swain <robert.swain@gmail.com>
Co-authored-by: Robert Swain <robert.swain@gmail.com>
Co-authored-by: Robert Swain <robert.swain@gmail.com>
Co-authored-by: Robert Swain <robert.swain@gmail.com>
Thank you for your suggestions. I did commit your suggestions except for the one about the display of primitive_topology_bits. I am not really sure how can I test it? |
I guess try |
Yes, what I actually meant was is there's a specific example or test that I can run that calls this function just to make sure that it displays correctly? |
I don’t think this should fail so I unfortunately have no suggestion how to trigger the error case. That’s why I’m suggesting just testing separately that a print or panic with a particular format string works. |
Ok , I just tested it now with load_gltf example using |
Ohhhhh, I'm sorry! |
|
So, now it just needs updating on top of |
What do you mean by on top of main? |
|
Ah you mean to update it in sync with the main branch? |
crates/bevy_pbr/src/material.rs
Outdated
| let asset_server = world.get_resource::<AssetServer>().unwrap(); | ||
| let render_device = world.get_resource::<RenderDevice>().unwrap(); | ||
| let asset_server = world | ||
| .get_resource::<AssetServer>() |
There was a problem hiding this comment.
We should replace these with the new world.resource::<AssetServer>() methods to avoid the need for duplicate panic messages / improve ergonomics.
There was a problem hiding this comment.
OK, Shall I do it in this pull request? or should this issue be resolved independently and across all other crates as well?
There was a problem hiding this comment.
OK, Shall I do it in this pull request? or should this issue be resolved independently and across all other crates as well?
There was a problem hiding this comment.
Personally I feel like there's no harm in merging this PR and then going through and changing get_resource() to resource() if that is the new(?) API to use. But it's up to @cart .
|
Your latest commit (merging main into your branch) went wrong. You didn't resolve the merge conflicts the right way. #4047 removed a lot of |
Yes, got it I am working on updating it to main branch now. |
|
Closing per discussion in #3899 <3 |
Objective
unwraps with eitherexpectorunwrap_or_else.unwrapwithexpect#3899 .Solution
unwraps with more helpful error messages.