Skip to content

Better error handling for systems #11562

@musjj

Description

@musjj

What problem does this solve or what need does it fill?

Handling Result<T, E> inside systems currently feels a bit awkward. The few options we have right now:

  • Call .unwrap() everywhere. This feels very unidiomatic in Rust.
  • Write custom log messages everywhere. This feels very boilerplaty for what could've been a single ?.
  • Have your system return Result<T, E>, then .pipe() it into bevy::utils::{warn, error, ...}.

I'm liking the third option the most. But the problem is that the log messages does not include any traceback information whatsoever, such as the name of the system where the error originated from. This makes it very hard to debug.

What solution would you like?

The usability of bevy::utils::{warn, error, ...} should be improved to make it easier to work with.

Or maybe there should be a built-in support for systems that returns Result<T, E>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleC-UsabilityA targeted quality-of-life change that makes Bevy easier to use

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions