Files
bevy/tools
loreball a5cbc9e6a3 Add new and severity based constructors to BevyError (#23684)
# Objective

Add constructors for making `BevyError`s with a specific severity.
Closes #23676.

## Solution

Add a `new` constructor plus 1 constructor for every possible
`Severity`.

## Testing

My eyes and a simple test case that constructs an error and tests if the
downcasting works.

---

## Showcase

A `BevyError` now has multiple constructor to create one with an
expected severity

```rust
use bevy::ecs::error::{BevyError, Severity};

let debug_error = BevyError::new(Severity::Debug, "This works with strings");

let warn_error = BevyError::warn("There's a constructor for each severity level");
```

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Ben Frankel <ben.frankel7@gmail.com>
2026-04-08 05:16:40 +00:00
..