bevyengine / bevyengine/bevy

Built-in commands should return Results whenever possible

Open
#17,271 3 comments 0 reactions 0 assignees View on GitHub
A-ECS D-Modest S-Ready-For-Implementation X-Blessed
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

First: I'll note that most of the built in commands as phrased in #17043 do not (yet) return errors, and I think updating everything is out of scope for this PR.

That being said, multiple paths have been laid for built-in commands to return handled errors.

The first path: all built-in commands are now exported as functions in the `command` and `entity_command` modules. If any of them were rephrased to return an error, then this would immediately be possible:

```rust
entity.queue_fallible(insert(Team::Blue).handle_error_with(warn()));
```

The more common case of using the built-in shorthand functions would use the default global error handler, which defaults to panicking but can be configured:

```rust
entity.insert(Team::Blue);
```

_Originally posted by @cart in https://github.com/bevyengine/bevy/issues/17215#issuecomment-2576139503_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.