Skip to content

Commit

Permalink
Add precisions about custom_failure example
Browse files Browse the repository at this point in the history
  • Loading branch information
nicopap committed Dec 6, 2023
1 parent b8b7389 commit 508f26e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ exclude = ["assets", ".github"]
version = "5.0.0"
edition = "2021"

[workspace]
members = ["macros_impl"]

[features]
default = ["full"]
full = ["dep:bevy"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ enum MyCustomError {
Error,
}

// Equivalent to #[sysfail(Box<dyn std::error::Error>)]
// Equivalent to #[sysfail(Log<Box<dyn std::error::Error>>)]
#[sysfail]
fn generic_failure() { /* ... */ }

Expand Down
12 changes: 12 additions & 0 deletions examples/custom_failure.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/// Define a custom [`Failure`] implementation.
///
/// This uses the [`bevy_debug_text_overlay`] crate to print on screen the text
/// of the error message.
///
/// Note that you would usually use the `screen_print!` macro from `bevy_debug_text_overlay`,
/// but here, we need special handling so that each individual system has its
/// own "slot" in the `bevy_debug_text_overlay` history, but also to display
/// the correct file/line number in the text showing up on screen.
///
/// A `Failure` implementation that doesn't care about the origin of an error
/// doesn't need to care about this though.
use std::fmt;
use std::marker::PhantomData;

Expand Down

0 comments on commit 508f26e

Please sign in to comment.