[erlang-questions] gen_statem and returning {next_event, internal, astate} from init/1

bengt e cean.ebengt@REDACTED
Thu Oct 18 15:00:57 CEST 2018


Greetings,

Running tests on a gen_statem application they all fail. Directly after
callback init/1. I see
** Reason for termination = error:{bad_action_from_state_function,
                                      {next_events,internal,reconnect}}
This is init, BTW:
init() -> {ok, connect, #{}, {next_event, internal, reconnect}}.

Looking in gen_statem.erl the calls after init() are (simplified):
enter(), where we add a new variable TransOpts (map, is empty)
loop_event_actions()
loop_event_actions_list()
parse_actions(), where if TransOpts is a map, we add a new variable
StateCall (boolean, is false)
parse_actions()
parse_actions_next_event(), where StateCall must be true to actually do
this.

Is there a way to persuade gen_statem to do parse_actions_next_event(),
even if TransOpts is a map?

Erlang OTP 20.3
Ubuntu 18.04.1 LTS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20181018/ead4ed94/attachment.htm>


More information about the erlang-questions mailing list