Update default error handler to use Severity.#23409
Update default error handler to use Severity.#23409alice-i-cecile merged 1 commit intobevyengine:mainfrom
Severity.#23409Conversation
|
The first two commits in this PR are the same as #23408 it looks like Edit: Oh I’m dumb, just read the description that it includes those changes 😅 |
6f2e1d8 to
59e8701
Compare
|
Might be worth having a |
|
That might be useful, but I think it would require something like: match_severity_up_to::<{ Severity::Warning as u8 }>since we don't have Alternatively we could have a separate handler for each case ( |
|
couldn't you just do #[track_caller]
#[inline]
pub fn match_severity_up_to(severity: Severity) -> impl Fn(BevyError, ErrorContext) {
move |err, ctx| {
...
}
} |
|
I can't seem to get that to work (at least without changing the signature of I'm not very experienced with function types, so I could totaly be missing something. |
I feel like that's an acceptable trade off. The error handler is the cold path so the extra bit of indirection from a function pointer is worth it I'd say (not certain but I'm fairly sure the cost of the indirection is out-shadowed by the cost of io from logging). It's not a massive need so ultimately up to you, but it would be nice to have. |
Followup to #22201.
Includes the changes in #23408, which is currently in the queue.Adds a new default error handler that defers to an error's
Severity.