-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat(ecs): configurable error handling for fallible systems #17753
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
Conversation
You can now configure error handlers for fallible systems. These can be configured on several levels: - Globally via `App::set_systems_error_handler` - Per-schedule via `Schedule::set_error_handler` - Per-system via a piped system (this is existing functionality) The "fallible_systems" example demonstrates the new functionality. This builds on top of bevyengine#17731, bevyengine#16589, bevyengine#17051. Signed-off-by: Jean Mertz <[email protected]>
Signed-off-by: Jean Mertz <[email protected]>
Signed-off-by: Jean Mertz <[email protected]>
Signed-off-by: Jean Mertz <[email protected]>
Wonderful, thanks! I will try very hard to find the time to review this sometime this week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basic strategy looks good to me. Exposing the different error handlers at the schedule level is definitely the most natural way to do this, even if I think that users will almost never set error handlers for specific schedules independently.
That said, I think we should:
- Improve the documentation to more clearly explain the core model. The
bevy_ecs::result
module feels like the best place for a detailed explanation, which should be linked wherever these setters are exposed. - Cut the error handling setter from
World
: it's neither convenient nor natural, and it's super easy to implement externally. - Add a few conveniences to the
result
module to make setting this behavior to info/warn/error/ignore easier.
3 can easily happen in follow-up though :)
Signed-off-by: Jean Mertz <[email protected]>
edit applied the change in 5c30e11. I realized #17731 does not give us access to So it probably makes sense to review and merge #17731 first, then update this PR to change the error handler signature from It also warrants a discussion on where our default Given that we're already doing a |
Signed-off-by: Jean Mertz <[email protected]>
Signed-off-by: Jean Mertz <[email protected]>
I like this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the right approach. Well done!
Signed-off-by: Jean Mertz <[email protected]>
Nice work, just small question. How does Rust Analyzer work with this when suggesting autocomplete? Does it conflict with the |
The bare functions aren’t exposed in the prelude, so it shouldn’t be an issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice refinement!
Thank you to everyone involved with the authoring or reviewing of this PR! This work is relatively important and needs release notes! Head over to bevyengine/bevy-website#1993 if you'd like to help out. |
You can now configure error handlers for fallible systems. These can be configured on several levels:
App::set_systems_error_handler
Schedule::set_error_handler
The default handler of panicking on error keeps the same behavior as before this commit.
The "fallible_systems" example demonstrates the new functionality.
This builds on top of #17731, #16589, #17051.