Attribute Macro bevy_mod_sysfail::sysfail
source · #[sysfail]
Expand description
sysfail
is an attribute macro you can slap on top of your systems to define
the handling of errors.
If you are lazy and don’t care about the return value, use quick_sysfail
.
Unlike chain
, this is done directly at the definition
site, and not when adding to the app. As a result, it’s easy to see at a glance
what kind of error handling is happening in the system, it also allows using
the system name as a label in system dependency specification.
The sysfail
attribute can only be used on systems returning a type
implementing the Failure
trait. Failure
is implemented for
sysfail
takes a single argument, it is one of the following:
log
: print theErr
of theResult
return value. Prints a very generic “A none value” when the return type isOption
. By default, most things are logged atWarn
level, but it is possible to customize the log level based on the error value.log(level = "{silent,trace,debug,info,warn,error}")
: This forces logging of errors at a certain level (make sure to add the quotes)ignore
: This is likelog(level="silent")
but simplifies the generated code.
Note that with log
, the macro generates a new system with additional
parameters.