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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

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 simple 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

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 simple quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants