-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
refactor: separate out PanicHandlerPlugin
#12557
Conversation
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.
We should be able to remove the dependency on console_error_panic_hook from bevy_log now, right?
I think this basically makes sense as a separate crate, although it's a bit weird to have something that small. What about as part of bevy_app instead? I think that will reduce complexity and controversy here by quite a bit. |
I am fine to go that way, but I am hoping in the future this could evolve to be configurable, e.g. struct PanicHandlerPlugin {
handler: Box<dyn Fn(&PanicInfo)>
} For now I think this makes sense as a very simple separation that can satisfy and close #12546 , with more sensible configuration to Android and other targets in the future. I'm also a little confused how you imagine this fitting into
Correct, I just removed it. |
I was just thinking drop the module in there directly; no changes beyond copy-paste. This is fine though: don't worry about changing it. More config would be great in the future. |
I think we need to update the docs for default plugins right. |
Fixed! Good catch. |
Objective
LogPlugin
silently overwrites the panic hook in WASM #12546Solution
PanicHandlerPlugin
.PanicHandlerPlugin
was added toDefaultPlugins
.DefaultPlugins
, in the case someone needs to configure custom panic handlers.Changelog
Added
PanicHandlerPlugin
was added to theDefaultPlugins
, which now sets sensible target-specific panic handlers.Changed
BevyLogPlugin
. Since this was separated out intoPanicHandlerPlugin
, you may need to add the newPanicHandlerPlugin
(included inDefaultPlugins
).Migration Guide
MinimalPlugins
withLogPlugin
for a WASM-target build, you will need to add the newPanicHandlerPlugin
to set the panic behavior to output to the console. Otherwise, you will see the default panic handler (opaque,unreachable
errors in the console).