Search code examples
c++umlboost-msmstate-diagram

How to prevent orthogonal region transition for error handling


I want to create the following state machine, with Boost MSM:

Simplified FSM with error states in an orthogonal region

I would like to be able to prevent the Error event to trigger the AllOk + Error == InError transition if the orthogonal state is on "B". For example, specifying transition for all orthogonal states would be nice. Something like:

{AllOk, B} + Error == {AllOk, A}

However, I cannot find how to do it with Boost MSM, neither with regular UML nomenclature, which makes me think I am going the wrong way.

Is there a classic "UML idiomatic" to handle this kind of behavior?

I see two possible solutions:

  • Put a guard on AllOk + Error == InError which checks if the other state is B, like this response.
  • Send a more specific error (in my case, CouldNotComputePath, as I am programming a robot), and somehow transform it in Error if it is not handled. I am not really sure how to do it.

Solution

  • Ok, I find a solution:

    The Error event can be "catched" in the MainStateMachine. If it is not, an internal transition is triggered on the MainStateMachine, which will send the EnterError event to make the other orthogonal state switch to InError.

    enter image description here