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

Don't ignore draw errors #13240

Merged
merged 10 commits into from
Jul 22, 2024
Merged

Don't ignore draw errors #13240

merged 10 commits into from
Jul 22, 2024

Conversation

IceSentry
Copy link
Contributor

@IceSentry IceSentry commented May 5, 2024

Objective

  • It's possible to have errors in a draw command, but these errors are ignored

Solution

  • Return a result with the error

Changelog

Renamed RenderCommandResult::Failure to RenderCommandResult::Skip
Added a reason string parameter to RenderCommandResult::Failure

Migration Guide

If you were using RenderCommandResult::Failure to just ignore an error and retry later, use RenderCommandResult::Skip instead.

This wasn't intentional, but this PR should also help with #12660 since we can turn a few unwraps into error messages now.

@IceSentry IceSentry added A-Rendering Drawing game state to the screen A-Diagnostics Logging, crash handling, error reporting and performance analysis C-Usability A targeted quality-of-life change that makes Bevy easier to use labels May 5, 2024
Copy link
Contributor

@jgayfer jgayfer left a comment

Choose a reason for hiding this comment

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

Always nice to have descriptive errors 👍

@IceSentry
Copy link
Contributor Author

Looks like I should use expect here and just log the errors. I'll update my PR soon.

@IceSentry
Copy link
Contributor Author

IceSentry commented May 5, 2024

Okay, so this generates a bunch of errors now, but it just generates a bunch RenderCommandFailure. So I'll need to also bubble up what those failures are. The main issue is that we use RenderCommandResult::Failure just to skip execution even if it isn't an error.

@IceSentry
Copy link
Contributor Author

IceSentry commented May 5, 2024

I added a skip variant to RenderCommandResult because that's how it's used every where. I also added a new Failure variant with a message so we can log real failures and not just expected situations to skip.

I'm not sure if I should now prefer to panic when I encounter a failure because this should be a real error now.

@mockersf
Copy link
Member

mockersf commented May 5, 2024

Looks like I should use expect here and just log the errors. I'll update my PR soon.

you kept 3 expect, is it... expected?

@IceSentry
Copy link
Contributor Author

IceSentry commented May 5, 2024

you kept 3 expect, is it... expected?

Yes and no, it's possible I missed one, but also, I want this PR to mostly keep the previous behaviour and we can start slowly finding places that should use Failure instead of panicking.

nvm those were indeed unexpected

@janhohenheim janhohenheim added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Uncontroversial This work is generally agreed upon D-Straightforward Simple bug fixes and API improvements, docs, test and examples labels Jun 26, 2024
@alice-i-cecile
Copy link
Member

@IceSentry let me know once merge conflicts are resolved so I can merge?

@alice-i-cecile alice-i-cecile added the S-Adopt-Me The original PR author has no intent to complete this work. Pick me up! label Jul 22, 2024
@tychedelia tychedelia removed the S-Adopt-Me The original PR author has no intent to complete this work. Pick me up! label Jul 22, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jul 22, 2024
Merged via the queue into bevyengine:main with commit 3faca1e Jul 22, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Diagnostics Logging, crash handling, error reporting and performance analysis A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Uncontroversial This work is generally agreed upon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants