Skip to content

Toro Cloud Dev Center


Handling undefined events and exceptions in Event Based Workflow

If you try to give an event when there is no transition, Event Based Workflow will throw an io.toro.fluxengine.exception.runtime.UndefinedEventException. If you'd like to respond to events that are not declared, you could create a transition with the $else event. This is useful when you have a dynamic value for $fluxEvent.

Event Based Workflow also allows the catching of exceptions that may occur when a state's action is invoked. To do this, create a transition with $exception. Having this event provides the transition with an additional input called $fluxException, a GloopModel of reference io.toro.fluxengine.exception.runtime.Event Based WorkflowRuntimeException, that provides the details of the thrown exception. In particular, these are its properties:

  1. message - a String that contains the exception message
  2. type - a String that contains the simple class name of the exception
  3. className - a String that contains the class name of the exception
  4. realException - an Object that contains the actual exception
  5. fluxStackTrace - a GloopModel array of state and transition calls

fluxStackTrace contains an array of stacktrace elements that describes which states and transitions were invoked from the start of a Event Based Workflow execution until the exception was thrown. A Event Based Workflow stacktrace element consists of the following properties:

  1. fluxName - name of the Event Based Workflow service
  2. stateName - name of the invoked state
  3. transition - event of the transition, null if the stacktrace element pertains to a state invocation
  4. stateIndex - index of the state on the Event Based Workflow definition