Skip to content

Small cleanup for ECS error handling #18280

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

Merged
merged 5 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,7 @@ impl App {

/// Set the global system error handler to use for systems that return a [`Result`].
///
/// See the [`bevy_ecs::result` module-level documentation](../../bevy_ecs/result/index.html)
/// See the [`bevy_ecs::error` module-level documentation](bevy_ecs::error)
/// for more information.
pub fn set_system_error_handler(
&mut self,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_app/src/sub_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ impl SubApp {

/// Set the global error handler to use for systems that return a [`Result`].
///
/// See the [`bevy_ecs::result` module-level documentation](../../bevy_ecs/result/index.html)
/// See the [`bevy_ecs::error` module-level documentation](bevy_ecs::error)
/// for more information.
pub fn set_system_error_handler(
&mut self,
Expand Down
10 changes: 6 additions & 4 deletions crates/bevy_ecs/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
//! [`panic`] error handler function is used, resulting in a panic with the error message attached.
//!
//! You can change the default behavior by registering a custom error handler, either globally or
//! per `Schedule`:
//! per [`Schedule`]:
//!
//! - [`App::set_system_error_handler`] sets the global error handler for all systems of the
//! current [`World`].
//! - `App::set_system_error_handler` (via `bevy_app`) sets the global error handler for all systems of the
//! current [`World`] by modifying the [`DefaultSystemErrorHandler`].
//! - [`Schedule::set_error_handler`] sets the error handler for all systems of that schedule.
//!
//! Bevy provides a number of pre-built error-handlers for you to use:
Expand Down Expand Up @@ -76,5 +76,7 @@ mod handler;
pub use bevy_error::*;
pub use handler::*;

/// A result type for use in fallible systems.
/// A result type for use in fallible systems, commands and observers.
///
/// The [`BevyError`] type is a type-erased error type with optional Bevy-specific diagnostics.
pub type Result<T = (), E = BevyError> = core::result::Result<T, E>;