Skip to content

Commit cbfeb94

Browse files
authored
include links in error messages (#12165)
# Objective Fixes #12118 ## Solution did a grip for any "B000" in the crates directory, and added the links note: ignored the test functions in this file https://github.com/bevyengine/bevy/blob/main/crates/bevy_ecs/src/system/mod.rs#L537
1 parent 2fbb4c6 commit cbfeb94

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

crates/bevy_ecs/src/reflect/entity_commands.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ fn insert_reflect(
194194
.expect("component should represent a type.");
195195
let type_path = type_info.type_path();
196196
let Some(mut entity) = world.get_entity_mut(entity) else {
197-
panic!("error[B0003]: Could not insert a reflected component (of type {type_path}) for entity {entity:?} because it doesn't exist in this World.");
197+
panic!("error[B0003]: Could not insert a reflected component (of type {type_path}) for entity {entity:?} because it doesn't exist in this World. See: https://bevyengine.org/learn/errors/#b0003");
198198
};
199199
let Some(type_registration) = type_registry.get_with_type_path(type_path) else {
200200
panic!("Could not get type registration (for component type {type_path}) because it doesn't exist in the TypeRegistry.");

crates/bevy_ecs/src/system/commands/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ fn insert<T: Bundle>(bundle: T) -> impl EntityCommand {
10721072
if let Some(mut entity) = world.get_entity_mut(entity) {
10731073
entity.insert(bundle);
10741074
} else {
1075-
panic!("error[B0003]: Could not insert a bundle (of type `{}`) for entity {:?} because it doesn't exist in this World.", std::any::type_name::<T>(), entity);
1075+
panic!("error[B0003]: Could not insert a bundle (of type `{}`) for entity {:?} because it doesn't exist in this World. See: https://bevyengine.org/learn/errors/#b0003", std::any::type_name::<T>(), entity);
10761076
}
10771077
}
10781078
}

crates/bevy_ecs/src/system/system_param.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ fn assert_component_access_compatibility(
249249
.map(|component_id| world.components.get_info(component_id).unwrap().name())
250250
.collect::<Vec<&str>>();
251251
let accesses = conflicting_components.join(", ");
252-
panic!("error[B0001]: Query<{query_type}, {filter_type}> in system {system_name} accesses component(s) {accesses} in a way that conflicts with a previous system parameter. Consider using `Without<T>` to create disjoint Queries or merging conflicting Queries into a `ParamSet`.");
252+
panic!("error[B0001]: Query<{query_type}, {filter_type}> in system {system_name} accesses component(s) {accesses} in a way that conflicts with a previous system parameter. Consider using `Without<T>` to create disjoint Queries or merging conflicting Queries into a `ParamSet`. See: https://bevyengine.org/learn/errors/#b0001");
253253
}
254254

255255
/// A collection of potentially conflicting [`SystemParam`]s allowed by disjoint access.
@@ -446,7 +446,7 @@ unsafe impl<'a, T: Resource> SystemParam for Res<'a, T> {
446446
let combined_access = system_meta.component_access_set.combined_access();
447447
assert!(
448448
!combined_access.has_write(component_id),
449-
"error[B0002]: Res<{}> in system {} conflicts with a previous ResMut<{0}> access. Consider removing the duplicate access.",
449+
"error[B0002]: Res<{}> in system {} conflicts with a previous ResMut<{0}> access. Consider removing the duplicate access. See: https://bevyengine.org/learn/errors/#b0002",
450450
std::any::type_name::<T>(),
451451
system_meta.name,
452452
);
@@ -536,11 +536,11 @@ unsafe impl<'a, T: Resource> SystemParam for ResMut<'a, T> {
536536
let combined_access = system_meta.component_access_set.combined_access();
537537
if combined_access.has_write(component_id) {
538538
panic!(
539-
"error[B0002]: ResMut<{}> in system {} conflicts with a previous ResMut<{0}> access. Consider removing the duplicate access.",
539+
"error[B0002]: ResMut<{}> in system {} conflicts with a previous ResMut<{0}> access. Consider removing the duplicate access. See: https://bevyengine.org/learn/errors/#b0002",
540540
std::any::type_name::<T>(), system_meta.name);
541541
} else if combined_access.has_read(component_id) {
542542
panic!(
543-
"error[B0002]: ResMut<{}> in system {} conflicts with a previous Res<{0}> access. Consider removing the duplicate access.",
543+
"error[B0002]: ResMut<{}> in system {} conflicts with a previous Res<{0}> access. Consider removing the duplicate access. See: https://bevyengine.org/learn/errors/#b0002",
544544
std::any::type_name::<T>(), system_meta.name);
545545
}
546546
system_meta
@@ -1031,7 +1031,7 @@ unsafe impl<'a, T: 'static> SystemParam for NonSend<'a, T> {
10311031
let combined_access = system_meta.component_access_set.combined_access();
10321032
assert!(
10331033
!combined_access.has_write(component_id),
1034-
"error[B0002]: NonSend<{}> in system {} conflicts with a previous mutable resource access ({0}). Consider removing the duplicate access.",
1034+
"error[B0002]: NonSend<{}> in system {} conflicts with a previous mutable resource access ({0}). Consider removing the duplicate access. See: https://bevyengine.org/learn/errors/#b0002",
10351035
std::any::type_name::<T>(),
10361036
system_meta.name,
10371037
);
@@ -1118,11 +1118,11 @@ unsafe impl<'a, T: 'static> SystemParam for NonSendMut<'a, T> {
11181118
let combined_access = system_meta.component_access_set.combined_access();
11191119
if combined_access.has_write(component_id) {
11201120
panic!(
1121-
"error[B0002]: NonSendMut<{}> in system {} conflicts with a previous mutable resource access ({0}). Consider removing the duplicate access.",
1121+
"error[B0002]: NonSendMut<{}> in system {} conflicts with a previous mutable resource access ({0}). Consider removing the duplicate access. See: https://bevyengine.org/learn/errors/#b0002",
11221122
std::any::type_name::<T>(), system_meta.name);
11231123
} else if combined_access.has_read(component_id) {
11241124
panic!(
1125-
"error[B0002]: NonSendMut<{}> in system {} conflicts with a previous immutable resource access ({0}). Consider removing the duplicate access.",
1125+
"error[B0002]: NonSendMut<{}> in system {} conflicts with a previous immutable resource access ({0}). Consider removing the duplicate access. See: https://bevyengine.org/learn/errors/#b0002",
11261126
std::any::type_name::<T>(), system_meta.name);
11271127
}
11281128
system_meta

crates/bevy_ecs/src/world/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ impl World {
887887
entity.despawn();
888888
true
889889
} else {
890-
warn!("error[B0003]: Could not despawn entity {:?} because it doesn't exist in this World.", entity);
890+
warn!("error[B0003]: Could not despawn entity {:?} because it doesn't exist in this World. See: https://bevyengine.org/learn/errors/#b0003", entity);
891891
false
892892
}
893893
}

crates/bevy_text/src/glyph_brush.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ impl GlyphBrush {
115115
if !text_settings.allow_dynamic_font_size
116116
&& font_atlas_set.len() > text_settings.soft_max_font_atlases.get()
117117
{
118-
warn_once!("warning[B0005]: Number of font atlases has exceeded the maximum of {}. Performance and memory usage may suffer.", text_settings.soft_max_font_atlases.get());
118+
warn_once!(
119+
"warning[B0005]: Number of font atlases has exceeded the maximum of {}. Performance and memory usage may suffer. See: https://bevyengine.org/learn/errors/#b0005",
120+
text_settings.soft_max_font_atlases.get());
119121
}
120122

121123
let texture_atlas = texture_atlases.get(&atlas_info.texture_atlas).unwrap();

0 commit comments

Comments
 (0)