[msm] handle errors and no_transition
Hi,
I have root fsm which has a sub-fsm. In the sub-fsm there are some
useful actions that can throw exceptions.
For that case any fsm has its own exception handler that translates
exception into a generic error event:
template
{};
Root:
struct S
{
typedef SubFsm::exit_pt
{};
the control flow: Root root; root.start(); root.process_event(init()); root.process_event(sub()); root.process_event(process()); output log: =============> start Root_::InitEvent: Enter to Root_ state. Root_::InitEvent: Enter to Root_::Empty state. =============> init Exit from Root_::Empty state. init: Enter to Root_::Initial state. =============> sub Exit from Root_::Initial state. sub: Enter to Root_::SubFsm_ state. sub: Enter to SubFsm_::Empty state. sub: Enter to SubFsm_::AllOk state. Exit from SubFsm_::Empty state. front::none: Enter to SubFsm_::Waiting state. =============> process Exit from SubFsm_::Waiting state. SubFsm_::A_Exception() State machine produces an exception on event process Current state: SubFsm_::Waiting Message: A_Process exception Exit from SubFsm_::AllOk state. error: Enter to SubFsm_::Error state. No transition from state Root_::SubFsm_ on event process Exit from SubFsm_::Waiting state. Exit from SubFsm_::Error state. Exit from Root_::SubFsm_ state. error: Enter to Root_::Error state. A I understood, after exception comes, the "process" event now in kind of "unhandled" state. So it rises up to the root fsm that doesn't have any suitable transition How to make the root or sub to "forget" about unhandled event?
I faced a strange problem: if an exception occurs, the sub successfully goes to Error state, the root has no_transition I use boost 1.55 and VS2013
<snip> Hi, It was intentional but in retrospect probably the wrong decision to consider an event not handled in case of an exception. As I'm pretty new to git, it might take longer for me to commit the change than you might want to wait, so please replace in back/state_machine.hpp, inside do_process_helper, line 1751 HANDLED_FALSE by HANDLED_TRUE to get the correct effect. HTH, Christophe
On 24.03.2014 0:54, christophe.j.henry@googlemail.com wrote:
It was intentional but in retrospect probably the wrong decision to consider an event not handled in case of an exception. As I'm pretty new to git, it might take longer for me to commit the change than you might want to wait,
so please replace in back/state_machine.hpp, inside do_process_helper, line 1751 HANDLED_FALSE by HANDLED_TRUE to get the correct effect.
Thanks, after replacing now it works.
I don't know if it'll go good (first commit for msm using git...) but I just committed in the develop branch.
I'm wondering, will your commit be in boost 1.56?
HTH, Christophe
participants (3)
-
Christophe Henry
-
christophe.j.henry@googlemail.com
-
Sam Fisher