Per world error handler#18810
Conversation
|
It looks like your PR is a breaking change, but you didn't provide a migration guide. Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes. |
|
@alice-i-cecile Why the needs-benchmarking label? This doesn't do any synchronization at all because, not being global, it just uses normal Rust ownership. Also, as mentioned in #18801 (comment), we can't benchmark this well (unless there's just something screwed up with my computer and the relevant benchmarks are actually consistent enough for other people). |
Perhaps it can be more than just a convenience. Maybe have a per-App and and a per-World handler, and if the World handler isn't set, it falls back on the App's handler. |
|
Something to that effect could work, but bevy_ecs can't know about Edit: I've solved this by keeping the old behavior of not letting the handler to be set multiple times (for an app). |
Perhaps a resource called |
c9a8a0c to
50c8fd3
Compare
eb03e3b to
cec1bbf
Compare
|
@cart I want to make sure you see this pr too. Imo it's probably the direction we should go, rather than the atomics. Still probably too late to slip in to 0.16 but maybe a bit less of a risk because there's no issues with platform support. |
|
Makes sense! And yeah I'd prefer to do this in 0.17 |
The But since you changed it to only perform the lookup once per schedule or once per failing command, I'd be surprised if there were any measurable overhead!
It's not just you; I also get lots of noise when I run the benchmarks. |
NthTensor
left a comment
There was a problem hiding this comment.
Please remove the pr number from the migration guide file name. Otherwise this looks fantastic.
alice-i-cecile
left a comment
There was a problem hiding this comment.
I'm really glad to see a nice solution here. Now that I have the time to review it I'm on board with this as the way forward.
|
Looks like got conflicted out of the last merge train. It should be good to get these conflicts resolved before the next one. |
Head branch was pushed to by a user without write access
bf5d8fe to
50a96fe
Compare
Objective
see original comment
Global error handlers don't actually need to be global – per world is enough. This allows using different handlers for different worlds and also removes the restrictions on changing the handler only once.
Solution
Each
Worldcan now store its own error handler in a resource.For convenience, you can also set the default error handler for an
App, which applies it to the worlds of allSubApps. The old behavior of only being able to set the error handler once is kept for apps.We also don't need the
configurable_error_handlerfeature anymore now.Testing
New/adjusted tests for failing schedule systems & observers.
Showcase