@@ -689,6 +689,13 @@ impl<'w, 's> Commands<'w, 's> {
689
689
/// This method is equivalent to iterating the batch
690
690
/// and calling [`insert`](EntityCommands::insert) for each pair,
691
691
/// but is faster by caching data that is shared between entities.
692
+ ///
693
+ /// # Fallible
694
+ ///
695
+ /// This command will fail if any of the given entities do not exist.
696
+ ///
697
+ /// It will internally return a [`TryInsertBatchError`](crate::world::error::TryInsertBatchError),
698
+ /// which will be handled by the [default error handler](crate::error::default_error_handler).
692
699
#[ track_caller]
693
700
pub fn insert_batch < I , B > ( & mut self , batch : I )
694
701
where
@@ -713,6 +720,13 @@ impl<'w, 's> Commands<'w, 's> {
713
720
/// This method is equivalent to iterating the batch
714
721
/// and calling [`insert_if_new`](EntityCommands::insert_if_new) for each pair,
715
722
/// but is faster by caching data that is shared between entities.
723
+ ///
724
+ /// # Fallible
725
+ ///
726
+ /// This command will fail if any of the given entities do not exist.
727
+ ///
728
+ /// It will internally return a [`TryInsertBatchError`](crate::world::error::TryInsertBatchError),
729
+ /// which will be handled by the [default error handler](crate::error::default_error_handler).
716
730
#[ track_caller]
717
731
pub fn insert_batch_if_new < I , B > ( & mut self , batch : I )
718
732
where
@@ -737,7 +751,12 @@ impl<'w, 's> Commands<'w, 's> {
737
751
/// and calling [`insert`](EntityCommands::insert) for each pair,
738
752
/// but is faster by caching data that is shared between entities.
739
753
///
740
- /// This command will emit a warning if any of the given entities do not exist.
754
+ /// # Fallible
755
+ ///
756
+ /// This command will fail if any of the given entities do not exist.
757
+ ///
758
+ /// It will internally return a [`TryInsertBatchError`](crate::world::error::TryInsertBatchError),
759
+ /// which will be handled by [logging the error at the `warn` level](warn).
741
760
#[ track_caller]
742
761
pub fn try_insert_batch < I , B > ( & mut self , batch : I )
743
762
where
@@ -763,7 +782,12 @@ impl<'w, 's> Commands<'w, 's> {
763
782
/// and calling [`insert_if_new`](EntityCommands::insert_if_new) for each pair,
764
783
/// but is faster by caching data that is shared between entities.
765
784
///
766
- /// This command will emit a warning if any of the given entities do not exist.
785
+ /// # Fallible
786
+ ///
787
+ /// This command will fail if any of the given entities do not exist.
788
+ ///
789
+ /// It will internally return a [`TryInsertBatchError`](crate::world::error::TryInsertBatchError),
790
+ /// which will be handled by [logging the error at the `warn` level](warn).
767
791
#[ track_caller]
768
792
pub fn try_insert_batch_if_new < I , B > ( & mut self , batch : I )
769
793
where
@@ -860,8 +884,13 @@ impl<'w, 's> Commands<'w, 's> {
860
884
/// execution of the system happens later. To get the output of a system, use
861
885
/// [`World::run_system`] or [`World::run_system_with`] instead of running the system as a command.
862
886
///
863
- /// If no system corresponds to the given [`SystemId`],
864
- /// this command will emit a warning.
887
+ /// # Fallible
888
+ ///
889
+ /// This command will fail if the given [`SystemId`]
890
+ /// does not correspond to a [`System`](crate::system::System).
891
+ ///
892
+ /// It will internally return a [`RegisteredSystemError`](crate::system::system_registry::RegisteredSystemError),
893
+ /// which will be handled by [logging the error at the `warn` level](warn).
865
894
pub fn run_system ( & mut self , id : SystemId ) {
866
895
self . queue ( command:: run_system ( id) . handle_error_with ( warn) ) ;
867
896
}
@@ -877,8 +906,13 @@ impl<'w, 's> Commands<'w, 's> {
877
906
/// execution of the system happens later. To get the output of a system, use
878
907
/// [`World::run_system`] or [`World::run_system_with`] instead of running the system as a command.
879
908
///
880
- /// If no system corresponds to the given [`SystemId`],
881
- /// this command will emit a warning.
909
+ /// # Fallible
910
+ ///
911
+ /// This command will fail if the given [`SystemId`]
912
+ /// does not correspond to a [`System`](crate::system::System).
913
+ ///
914
+ /// It will internally return a [`RegisteredSystemError`](crate::system::system_registry::RegisteredSystemError),
915
+ /// which will be handled by [logging the error at the `warn` level](warn).
882
916
pub fn run_system_with < I > ( & mut self , id : SystemId < I > , input : I :: Inner < ' static > )
883
917
where
884
918
I : SystemInput < Inner < ' static > : Send > + ' static ,
@@ -965,8 +999,13 @@ impl<'w, 's> Commands<'w, 's> {
965
999
/// and attempting to use it afterwards will result in an error.
966
1000
/// Re-adding the removed system will register it with a new `SystemId`.
967
1001
///
968
- /// If no system corresponds to the given [`SystemId`],
969
- /// this command will emit a warning.
1002
+ /// # Fallible
1003
+ ///
1004
+ /// This command will fail if the given [`SystemId`]
1005
+ /// does not correspond to a [`System`](crate::system::System).
1006
+ ///
1007
+ /// It will internally return a [`RegisteredSystemError`](crate::system::system_registry::RegisteredSystemError),
1008
+ /// which will be handled by [logging the error at the `warn` level](warn).
970
1009
pub fn unregister_system < I , O > ( & mut self , system_id : SystemId < I , O > )
971
1010
where
972
1011
I : SystemInput + Send + ' static ,
@@ -980,8 +1019,13 @@ impl<'w, 's> Commands<'w, 's> {
980
1019
/// - [`World::run_system_cached`]
981
1020
/// - [`World::register_system_cached`]
982
1021
///
983
- /// If the given system is not currently cached,
984
- /// this command will emit a warning.
1022
+ /// # Fallible
1023
+ ///
1024
+ /// This command will fail if the given system
1025
+ /// is not currently cached in a [`CachedSystemId`](crate::system::CachedSystemId) resource.
1026
+ ///
1027
+ /// It will internally return a [`RegisteredSystemError`](crate::system::system_registry::RegisteredSystemError),
1028
+ /// which will be handled by [logging the error at the `warn` level](warn).
985
1029
pub fn unregister_system_cached < I , O , M , S > ( & mut self , system : S )
986
1030
where
987
1031
I : SystemInput + Send + ' static ,
@@ -1108,8 +1152,13 @@ impl<'w, 's> Commands<'w, 's> {
1108
1152
///
1109
1153
/// Calls [`World::try_run_schedule`](World::try_run_schedule).
1110
1154
///
1111
- /// If the schedule is not available to be run,
1112
- /// this command will emit a warning.
1155
+ /// # Fallible
1156
+ ///
1157
+ /// This command will fail if the given [`ScheduleLabel`]
1158
+ /// does not correspond to a [`Schedule`](crate::schedule::Schedule).
1159
+ ///
1160
+ /// It will internally return a [`TryRunScheduleError`](crate::world::error::TryRunScheduleError),
1161
+ /// which will be handled by [logging the error at the `warn` level](warn).
1113
1162
///
1114
1163
/// # Example
1115
1164
///
0 commit comments