macro_rules! ret_fail { ($cx:expr, $msg:literal) => { ... }; ($cx:expr, $fmt:literal $(, $arg:expr)*) => { ... }; ($cx:expr, $error:expr) => { ... }; }
Expand description
Create a Ret
instance that terminates this actor with failure
ret_fail!(cx, "format...", fmt-args...);
ret_fail!(cx, "literal...");
ret_fail!(cx, error);
This accepts any message, and terminates the actor with the given
failure message/error, as for fail!
.
This can be used as a termination notifier for a child actor in
the actor!
or actor_new!
call. It allows cascading actor
failure upwards until it reaches an ancestor that can handle it.
Using this macro, even successful termination of the child actor
is treated as unexpected and a cause for failure, i.e. using this
assumes that the child is normally supposed to outlive the parent
actor, e.g. it only dies when the parent actor drops the reference
to it. If you wish to allow the child to terminate successfully
or be killed, consider using ret_failthru!
instead.
The arguments are treated as for fail!
, calling on to
Cx::fail
, Cx::fail_str
or Cx::fail_string
.
Note that errors are not normally chained in Stakker, i.e. the
failure wouldn’t normally contain details of the failures which
lead to that failure. The detailed history of a failure can be
analyzed by running with the logger feature enabled, and
looking at Open
and Close
events.