bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Don't ignore draw errors

Open IceSentry opened this issue 1 year ago • 5 comments

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 https://github.com/bevyengine/bevy/issues/12660 since we can turn a few unwraps into error messages now.

IceSentry avatar May 05 '24 02:05 IceSentry

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

IceSentry avatar May 05 '24 03:05 IceSentry

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 avatar May 05 '24 04:05 IceSentry

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.

IceSentry avatar May 05 '24 04:05 IceSentry

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?

mockersf avatar May 05 '24 22:05 mockersf

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

IceSentry avatar May 05 '24 22:05 IceSentry

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

alice-i-cecile avatar Jul 01 '24 13:07 alice-i-cecile