commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rahul Akolkar" <>
Subject Re: [scxml] Handling exceptions thrown by custom actions
Date Tue, 16 May 2006 18:44:42 GMT
On 5/15/06, Nestor Urquiza <> wrote:
> Hello guys,
> Could you point me to what you think might be the best
> approach here?
> I receive a request and pass that request to the scxml
> engine by means of triggering the proper event. The
> event then put the FSM in an action state where some
> internal methods (custom actions) are called.
> How could I just suspend the whole execution of the
> trigger and go back to the state the application was
> before receiving the external event? Right now if an
> exception is thrown from a custom action then a  new
> SCXMLExpressionException(e) is thrown as well so the
> FSM stops and therefore the FSM stops at the action
> state while of course I want it to go back to the
> original state.

This has been asked before, so please allow me to paste just the
relevant bit from an earlier post [1]:


A more useful mechanism than throwing a Java exception is to catch the
error condition / checked exception and fire a derived error event on
the state machine.

In the <my:action>'s execute() method:

// on error condition or checked exception
derivedEvents.add(new TriggerEvent("",

And the SCXML snippet:

<state id="foo">
    <my:action ... />
  <transition event="" target="errorstate" />
  <!-- other transitions etc. -->


This, along with the SCXML <history> element, will get you what you need here.



> Thanks a lot,
> Nestor Urquiza

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message