Boost logo

Boost Users :

Subject: [Boost-users] [MSM] state transitions and exceptions
From: Stephan Menzel (stephan.menzel_at_[hidden])
Date: 2012-03-29 04:55:17


Everyone,

I did just get around to give the MSM a first shot and I have say I am
impressed at the neat design, the ease of use, "understandability",
tutorial ... exceptional work. Really great and it helped me a great
deal so far. So thanks a bunch for this teriffic addition to boost.
That's the kind of stuff I love boost for.

There is one question however that puzzles me. How can / do I prevent
state transistions when a transition function throws?

Most transition functions are defined like that:

void so_transition(event::Cause const &e) {

   methodCausingAnException();
}

The tutorial only mentions this at the very end of the back-end docs
and this is not clear to me. I have stuff inside my transitions that
may throw and the example text mentiones other valid examples (like
connect() logic). So what am I supposed to do here?

This?

void so_transition(event::Cause const &e) {
  try {
     methodCausingAnException();
  } catch (const std::exception &sex) {
     return ???
  }
}

The type is void and I can't return anything that would prevent the transition.
Or should I just let the exception pass? What is the correct way?

Suggestions are appreciated,

Stephan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net