-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Per world error handler #18810
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
base: main
Are you sure you want to change the base?
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
50c8fd3
to
7abcbc4
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. |
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
World
can 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 allSubApp
s. 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_handler
feature anymore now.Testing
New/adjusted tests for failing schedule systems & observers.
Showcase