@@ -89,14 +89,19 @@ use crate::{
8989///
9090/// # Error handling
9191///
92- /// Commands can return a [`Result`](crate::result::Result), which can be passed to
93- /// an error handler. Error handlers are functions/closures of the form
94- /// `fn(&mut World, CommandError)`.
92+ /// A [`Command`] can return a [`Result`](crate::result::Result),
93+ /// which will be passed to an error handler if the `Result` is an error.
9594///
96- /// The default error handler panics. It can be configured by enabling the `configurable_error_handler`
97- /// cargo feature, then setting the `GLOBAL_ERROR_HANDLER`.
95+ /// Error handlers are functions/closures of the form `fn(&mut World, Error)`.
96+ /// They are granted exclusive access to the [`World`], which enables them to
97+ /// respond to the error in whatever way is necessary.
9898///
99- /// Alternatively, you can customize the error handler for a specific command by calling [`Commands::queue_handled`].
99+ /// The [default error handler](error_handler::default) panics.
100+ /// It can be configured by enabling the `configurable_error_handler` cargo feature,
101+ /// then setting the `GLOBAL_ERROR_HANDLER`.
102+ ///
103+ /// Alternatively, you can customize the error handler for a specific command
104+ /// by calling [`Commands::queue_handled`].
100105///
101106/// The [`error_handler`] module provides some simple error handlers for convenience.
102107///
@@ -546,7 +551,8 @@ impl<'w, 's> Commands<'w, 's> {
546551
547552 /// Pushes a generic [`Command`] to the command queue.
548553 ///
549- /// If the [`Command`] returns a [`Result`], it will be handled using the [default error handler](error_handler::default).
554+ /// If the [`Command`] returns a [`Result`],
555+ /// it will be handled using the [default error handler](error_handler::default).
550556 ///
551557 /// To use a custom error handler, see [`Commands::queue_handled`].
552558 ///
@@ -589,8 +595,11 @@ impl<'w, 's> Commands<'w, 's> {
589595 pub fn queue < C : Command < T > + HandleError < T > , T > ( & mut self , command : C ) {
590596 self . queue_internal ( command. handle_error ( ) ) ;
591597 }
592- /// Pushes a generic [`Command`] to the command queue. If the command returns a [`Result`] the given
593- /// `error_handler` will be used to handle error cases.
598+
599+ /// Pushes a generic [`Command`] to the command queue.
600+ ///
601+ /// If the [`Command`] returns a [`Result`],
602+ /// the given `error_handler` will be used to handle error cases.
594603 ///
595604 /// To implicitly use the default error handler, see [`Commands::queue`].
596605 ///
@@ -1137,7 +1146,7 @@ impl<'w, 's> Commands<'w, 's> {
11371146/// Most [`Commands`] (and thereby [`EntityCommands`]) are deferred: when you call the command,
11381147/// if it requires mutable access to the [`World`] (that is, if it removes, adds, or changes something),
11391148/// it's not executed immediately. Instead, the command is added to a "command queue."
1140- /// The command queue is applied between [`Schedules`](bevy_ecs ::schedule::Schedule), one by one,
1149+ /// The command queue is applied between [`Schedules`](crate ::schedule::Schedule), one by one,
11411150/// so that each command can have exclusive access to the World.
11421151///
11431152/// # Fallible
@@ -1148,14 +1157,19 @@ impl<'w, 's> Commands<'w, 's> {
11481157///
11491158/// # Error handling
11501159///
1151- /// [`EntityCommands`] can return a [`Result`](crate::result::Result), which can be passed to
1152- /// an error handler. Error handlers are functions/closures of the form
1153- /// `fn(&mut World, CommandError)`.
1160+ /// An [`EntityCommand`] can return a [`Result`](crate::result::Result),
1161+ /// which will be passed to an error handler if the `Result` is an error.
1162+ ///
1163+ /// Error handlers are functions/closures of the form `fn(&mut World, Error)`.
1164+ /// They are granted exclusive access to the [`World`], which enables them to
1165+ /// respond to the error in whatever way is necessary.
11541166///
1155- /// The default error handler panics. It can be configured by enabling the `configurable_error_handler`
1156- /// cargo feature, then setting the `GLOBAL_ERROR_HANDLER`.
1167+ /// The [default error handler](error_handler::default) panics.
1168+ /// It can be configured by enabling the `configurable_error_handler` cargo feature,
1169+ /// then setting the `GLOBAL_ERROR_HANDLER`.
11571170///
1158- /// Alternatively, you can customize the error handler for a specific command by calling [`EntityCommands::queue_handled`].
1171+ /// Alternatively, you can customize the error handler for a specific command
1172+ /// by calling [`EntityCommands::queue_handled`].
11591173///
11601174/// The [`error_handler`] module provides some simple error handlers for convenience.
11611175pub struct EntityCommands < ' a > {
@@ -1754,7 +1768,8 @@ impl<'a> EntityCommands<'a> {
17541768
17551769 /// Pushes an [`EntityCommand`] to the queue, which will get executed for the current [`Entity`].
17561770 ///
1757- /// If the [`EntityCommand`] returns a [`Result`], it will be handled using the [default error handler](error_handler::default).
1771+ /// If the [`EntityCommand`] returns a [`Result`],
1772+ /// it will be handled using the [default error handler](error_handler::default).
17581773 ///
17591774 /// To use a custom error handler, see [`EntityCommands::queue_handled`].
17601775 ///
@@ -1788,7 +1803,9 @@ impl<'a> EntityCommands<'a> {
17881803 }
17891804
17901805 /// Pushes an [`EntityCommand`] to the queue, which will get executed for the current [`Entity`].
1791- /// If the command returns a [`Result`] the given `error_handler` will be used to handle error cases.
1806+ ///
1807+ /// If the [`EntityCommand`] returns a [`Result`],
1808+ /// the given `error_handler` will be used to handle error cases.
17921809 ///
17931810 /// To implicitly use the default error handler, see [`EntityCommands::queue`].
17941811 ///
0 commit comments