feat(ecs): configurable error handling for fallible systems#17753
feat(ecs): configurable error handling for fallible systems#17753alice-i-cecile merged 8 commits intobevyengine:mainfrom
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 <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
|
Wonderful, thanks! I will try very hard to find the time to review this sometime this week. |
alice-i-cecile
left a comment
There was a problem hiding this comment.
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::resultmodule 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
resultmodule to make setting this behavior to info/warn/error/ignore easier.
3 can easily happen in follow-up though :)
Signed-off-by: Jean Mertz <git@jeanmertz.com>
|
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 <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
I like this! |
cart
left a comment
There was a problem hiding this comment.
I think this is the right approach. Well done!
Signed-off-by: Jean Mertz <git@jeanmertz.com>
|
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. |
|
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_handlerSchedule::set_error_handlerThe 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.