error/
error.rs

1use bevy::prelude::*;
2use bevy_local_commands::{BevyLocalCommandsPlugin, LocalCommand, ProcessError};
3
4fn main() {
5    App::new()
6        .add_plugins((MinimalPlugins, BevyLocalCommandsPlugin))
7        .add_systems(Startup, startup)
8        .add_systems(Update, update)
9        .run();
10}
11
12fn startup(mut commands: Commands) {
13    commands.spawn(LocalCommand::new("commandthatdoesnotexist"));
14}
15
16fn update(mut process_error: MessageReader<ProcessError>) {
17    for error in process_error.read() {
18        println!(
19            "Error running command ({:?}): {:?}",
20            error.entity, error.info
21        );
22        // Quit the app
23        std::process::exit(0);
24    }
25}