Skip to content

Add a customizable global error handler #825

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Vrixyz
Copy link
Contributor

@Vrixyz Vrixyz commented Apr 18, 2025

This allows user to react to an engine error, be it panic or try to fix the problem.

Took inspiration from https://github.com/bevyengine/bevy/blob/main/crates/bevy_ecs/src/error/handler.rs.

Current Status

Proof of concept is here, I'd like to add an example or test where user code is fixing an issue (removes a rigidbody ?)

More errors should probably be added in there.

Should this be behind a feature flag ?

no-std should be accounted for: be it allow it (custom oncelock), or not supporting it.

if proxy.aabb.mins[dim] < self.max_bound {
default_error_handler()(Error::SapAxisInsert(format!(
"proxy.aabb.mins {} (in {:?}) <= max_bound {}",
proxy.aabb.mins[dim], proxy.aabb, self.max_bound
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

store values rather than string (proxy.abb, dim, max_bounds)

// TODO: add more context:
// - offending rigidbody ?
// - backtrace ?
assert!(tx.send(1).is_ok());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: send the error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant