Closed pasierb closed 5 years ago
There are two options in the existing implementation you could use to find out when an FSM is asked to handle input for which it has no handler:
nohandler
event (see this).*
catch-all handler and throw inside it. You can place this catch-all handler in a state or at the top level of the FSM (where it would be activated in any state).The reason I'd pick the latter option above is because you may have an FSM that handles a total of say, 7 different inputs, but not all 7 are handled in every state. The intended default behavior is for the FSM to no-op/ignore inputs that aren't valid for the current state. The catch-all handlers provide a way to handle "unknown inputs" explicitly, without breaking the intended defaults. Hope that helps!
@ifandelse What you think about that? I caught myself couple times debugging this silent fail, that turned out to be transition that was not defined in current state. Would be nice if there was an error thrown is such case. I'm happy to create PR, but wanted to see what you think about it first.