-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Command error handling should work off of non-erased error types #17273
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
Comments
So in terms of next steps for error handling, I think our priority should be exposing useful backtrace info (anyhow-style). Currently the backtrace printed for our boxed error is from where the handler panicked, which is useless. My plan involved using the anyhow-style backtrace feature. The boxed error type in Sadly I think this implies that commands should always return our general purpose / anyhow-style error type. The "niceness" of returning whatever error type we want isn't worth losing useful backtraces. I think it would also be good to report system debug information when a command fails. Not quite sure yet the best way to do it, but it seems possible. |
Totally agree with cart here. I actually started looking into exactly this direction after we shipped the basic fallible systems stuff. If it's helpful, here's what I eventually designed:
You can see some of the preliminary work here: https://github.com/NthTensor/bevy/tree/error_reporting. I'm kind of on the fence about this design. Rust errors typically come in two flavors: concrete on the supply side (think As an example of just one of the things this end-to-end loop would let us do, we could adapt our current On the other hand, maybe this would be way over-engineered. IDK. |
I like the general concept, but I think we should slowly extend the scope and capabilities as the need arises, rather than try to build the whole paradigm all at once. This allows us to take our first steps quickly, and lets us make each additional choice on its own time / let it succeed on its own merits. Some thoughts:
So in summary, I'm not fully against the "bevy requires its own error traits and explicit conversion to them for non-bevy errors", but before going down that route I would like to explore the limits of the "bevy is compatible with all error types, attaches additional data when possible". And if we ever discover that we need additional structured data from the error types themselves, develop a parse-able format that we embed in the error message. |
Originally posted by @cart in #17215 (comment)
The text was updated successfully, but these errors were encountered: