Skip to content

Commit 54edab7

Browse files
joseph-gioProfLander
authored andcommitted
Improve the panic message for schedule build errors (bevyengine#7860)
# Objective The `ScheduleBuildError` type has a `Display` implementation which beautifully formats the error. However, schedule build errors are currently reported using `unwrap()`, which uses the `Debug` implementation and makes the error message look unfished. ## Solution Use `unwrap_or_else` so we can customize the formatting of the error message.
1 parent e712fa5 commit 54edab7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/bevy_ecs/src/schedule/schedule.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ impl Schedule {
245245
/// Runs all systems in this schedule on the `world`, using its current execution strategy.
246246
pub fn run(&mut self, world: &mut World) {
247247
world.check_change_ticks();
248-
self.initialize(world).unwrap();
248+
self.initialize(world).unwrap_or_else(|e| panic!("{e}"));
249249
self.executor.run(&mut self.executable, world);
250250
}
251251

0 commit comments

Comments
 (0)