3 Replies Latest reply on Aug 1, 2008 5:45 PM by jnusaira

    JPDL Exception Handling

    shouvikrb

      I am having a hell of a time doing exception handling when a JPDL delegate gets an exsception. I added the following element in the jpdl (btw, have read and searched thru many many documents. So I think I have paid my dues from that respect :)


      <exception-handler>
                  <action expression="#{someComp.handleException}" />
      </exception-handler>
      


      and it got called correctly. All I want now is to redirect the user to an error page and not blow up this JPDL conversation. Is there a way to do that?


      Related to the above is that if I have a pageflow-A which goes to a sub-process pageFlow-B and the exception is caught within pageFlow-B, is there a way to reposition on a node on pageflow-B. Seems like I can get a handle to the org.jboss.seam.pageflow.Pageflow object, but it is the pageflow-A holder. How do I reposition to a pageflow-B node with this object. I got the name of pageflow-B by doing a object.subProcessInstance().getProcessDefintion().getName() but then head started spinning !!


      If anybody has written a few lines of code to do this, it will be helpful for anybody working with JPDL.


      Thanks for any hints.


      -Shouvik

        • 1. Re: JPDL Exception Handling
          kukeltje.ronald.jbpm.org

          (btw, have read and searched thru many many documents. So I think I have paid my dues from that respect :)

          Cool... including the Kamasutra?



          and it got called correctly. All I want now is to redirect the user to an error page and not blow up this JPDL conversation. Is there a way to do that?

          Errorhandling cannot influence the flow of the process in jBPM, at least not in jPDL, not sure about pageflow. You should either catch the error in the delegate and use that to direct the flow (e.g. by setting a processvariable and use that in a decision)




          Related to the above is that if I have a pageflow-A which goes to a sub-process pageFlow-B and the exception is caught within pageFlow-B, is there a way to reposition on a node on pageflow-B.


          With jPDL no, with pageflow I'm not sure. Errorhandling should not be used like you do in Java. Exceptions are best handled in delegates or do a setRollback so the whole transaction is rolled back, including all jBPM stuff.


          hth a little


          • 2. Re: JPDL Exception Handling
            shouvikrb

            Thanks. That helps. I have seen the following in jBPM document.


            Note that in an action that handles an exception, it is possible to put the token in an arbitrary node in the graph
            with Token.setNode(Node node).
            



            I am going to try and see if after the exception is caught, I can reposition on a node which is basically the error.xhtml node.


            Dont know if that is the right thing to do but I will give it a shot.


            thanks again.


            PS - No KS reading has happened :)

            • 3. Re: JPDL Exception Handling
              jnusaira
              This was actually the #1 reason why the team here is using Seam but not hte jBPM annotations for it.

              WE have about 5-7 few flows. And each flow probably has 13 nodes on it.

              We really dont want to stick a decision node inbetween each one for exception handling.