bevy/crates/bevy_ecs/src
Chris Russell d5c5de20b1 Use Display instead of Debug in the default error handler (#18629)
# Objective

Improve error messages for missing resources.  

The default error handler currently prints the `Debug` representation of
the error type instead of `Display`. Most error types use
`#[derive(Debug)]`, resulting in a dump of the structure, but will have
a user-friendly message for `Display`.

Follow-up to #18593

## Solution

Change the default error handler to use `Display` instead of `Debug`.  

Change `BevyError` to include the backtrace in the `Display` format in
addition to `Debug` so that it is still included.

## Showcase

Before: 

```
Encountered an error in system `system_name`: SystemParamValidationError { skipped: false, message: "Resource does not exist", param: "bevy_ecs::change_detection::Res<app_name::ResourceType>" }

Encountered an error in system `other_system_name`: "String message with\nmultiple lines."
```

After

```
Encountered an error in system `system_name`: Parameter `Res<ResourceType>` failed validation: Resource does not exist

Encountered an error in system `other_system_name`: String message with
multiple lines.
```
2025-03-31 22:33:28 +02:00
..
entity Rename EntityBorrow/TrustedEntityBorrow to ContainsEntity/EntityEquivalent (#18470) 2025-03-30 10:24:00 +02:00
error Use Display instead of Debug in the default error handler (#18629) 2025-03-31 22:33:28 +02:00
event bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
identifier bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
observer reexport entity set collections in entity module (#18413) 2025-03-30 10:24:00 +02:00
query Rename EntityBorrow/TrustedEntityBorrow to ContainsEntity/EntityEquivalent (#18470) 2025-03-30 10:24:00 +02:00
reflect Replace VisitEntities with MapEntities (#18432) 2025-03-24 00:09:29 +01:00
relationship Fix relationship macro for multiple named members fields (#18530) 2025-03-27 22:58:21 +01:00
schedule Fix run_system for adapter systems wrapping exclusive systems (#18406) 2025-03-26 19:06:51 +01:00
storage Queued component registration (#18173) 2025-03-10 21:46:27 +00:00
system Use Display instead of Debug in the default error handler (#18629) 2025-03-31 22:33:28 +02:00
world Rename EntityBorrow/TrustedEntityBorrow to ContainsEntity/EntityEquivalent (#18470) 2025-03-30 10:24:00 +02:00
archetype.rs Fix clippy::let_and_return in bevy_ecs (#18481) 2025-03-24 00:09:30 +01:00
batching.rs Fix *most* clippy lints (#15906) 2024-10-14 20:52:35 +00:00
bundle.rs Fix clippy::let_and_return in bevy_ecs (#18481) 2025-03-24 00:09:30 +01:00
change_detection.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
component.rs Required Components: pass through all tokens in {} and () syntax (#18578) 2025-03-27 22:56:49 +01:00
entity_disabling.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
hierarchy.rs Regression fix: Reintroduce sorting/reordering methods on Children (#18476) 2025-03-24 00:14:22 +01:00
intern.rs Move hashbrown and foldhash out of bevy_utils (#17460) 2025-01-23 16:46:08 +00:00
label.rs do_not_recommend interned Labels (#17950) 2025-02-25 23:46:21 +00:00
lib.rs Rename EntityBorrow/TrustedEntityBorrow to ContainsEntity/EntityEquivalent (#18470) 2025-03-30 10:24:00 +02:00
name.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
removal_detection.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
resource.rs Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
spawn.rs Implement SpawnableList for Vec<Bundle> (#18259) 2025-03-11 20:32:37 +00:00
traversal.rs Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00