1 Reply Latest reply on Jun 28, 2007 4:39 AM by Koen Aers

    Problem with Exception Handler or I just can't do this?

    Jason Greiner Newbie

      Could someone tell me if this is an issue with exception handling or if I am just missing something, and doing it wrong.

      Most nodes or ActionHandlers that access the database, or check on data, I have an exception handler. Something like

      <exception-handler exception-class="java.lang.Exception">
       <action class="com.pubco.das.process.handlers.PreflightExceptionHandler"></action>
       </exception-handler>
      


      Then my exception handler sets the process instance to a task node.
       Node ebNode = ctx.getProcessInstance().getProcessDefinition().getNode(ProcessVariables.DASMASTER_EXCEPTION);
       ebNode.enter(ctx);
      


      What I am finding is that this is working fine, except the node that threw the exception went ahead and transitioned its self to the next node in the process. I am seeing this on Decision nodes on a regular basis, I am currently testing to see if this happens on other nodes.

      Could someone tell me if that is wrong or a bad practice? Do I need to manually stop the processInstance?

      Thanks

        • 1. Re: Problem with Exception Handler or I just can't do this?
          Koen Aers Master

          Exception handlers have limited use. They cannot influence the graph excecution in the way you apparently want it. Their use is to perform some corrective action (set variables, send email, jms message etc.) and then either continue the graph execution (the behaviour you observe) or else rethrow an exception for the transaction to fail and the token to end up in the node it started from.
          So the behaviour you see is correct.

          Regards,
          Koen