If this function's body does not consist of solely one of two
@@ -1368,11 +1365,6 @@ handle_event(_, _, State, Data) ->
It is recommended to use an atom as Reason since
it will be wrapped in an {error,Reason} tuple.
-
- This function can use
- erlang:throw/1
- to return Result or Reason.
-
@@ -1432,11 +1424,6 @@ handle_event(_, _, State, Data) ->
or ignore; see
start_link/3,4.
-
- This function can use
- erlang:throw/1
- to return Result.
-
This callback is optional, so a callback module does not need
@@ -1477,10 +1464,14 @@ handle_event(_, _, State, Data) ->
This callback is optional, so a callback module does not need
to export it. The gen_statem module provides a default
implementation of this function that returns
- {State,Data}. If this callback fails, the default
- function returns {State,Info},
- where Info informs of the crash but no details,
- to hide possibly sensitive data.
+ {State,Data}.
+
+
+ If this callback is exported but fails,
+ to hide possibly sensitive data,
+ the default function will instead return {State,Info},
+ where Info says nothing but the fact that
+ format_status/2 has crashed.
This function is called by a gen_statem process when
@@ -1541,11 +1532,6 @@ handle_event(_, _, State, Data) ->
printed in log files. Another use is to hide sensitive data from
being written to the error log.
-
- This function can use
- erlang:throw/1
- to return Status.
-
@@ -1620,9 +1606,12 @@ handle_event(_, _, State, Data) ->
see action().
- These functions can use
- erlang:throw/1,
- to return the result.
+ Note the fact that you can use
+ throw
+ to return the result, which can be useful.
+ For example to bail out with throw(keep_state_and_data)
+ from deep within complex code that is in no position to
+ return {next_state,State,Data}.
@@ -1695,11 +1684,6 @@ handle_event(_, _, State, Data) ->
and an error report is issued using
error_logger:format/2.
-
- This function can use
- erlang:throw/1
- to return Ignored, which is ignored anyway.
-
diff --git a/lib/stdlib/src/gen_statem.erl b/lib/stdlib/src/gen_statem.erl
index 6d7b461ee3..a39503cb6b 100644
--- a/lib/stdlib/src/gen_statem.erl
+++ b/lib/stdlib/src/gen_statem.erl
@@ -1295,7 +1295,7 @@ format_status(Opt, PDict, #{module := Module}, State, Data) ->
_:_ ->
format_status_default(
Opt, State,
- "Module:format_status/2 crashed")
+ atom_to_list(Module) ++ ":format_status/2 crashed")
end;
false ->
format_status_default(Opt, State, Data)
@@ -1303,10 +1303,10 @@ format_status(Opt, PDict, #{module := Module}, State, Data) ->
%% The default Module:format_status/2
format_status_default(Opt, State, Data) ->
- SSD = {State,Data},
+ StateData = {State,Data},
case Opt of
terminate ->
- SSD;
+ StateData;
_ ->
- [{data,[{"State",SSD}]}]
+ [{data,[{"State",StateData}]}]
end.
--
cgit v1.2.3