3 Replies Latest reply on Jan 4, 2011 4:06 PM by futuredan

    How do I propogate an exception up a route?

    futuredan

      I have a piece of code like the following:

       

           boolean rc = this.myChannel.sendSync( teeXchg );

           teeStatus = teeXchg.getStatus();

       

      This sends the message to the following route:

       

            

       

      I have two problems.

       

      First, if I do not define an error handler in the fromXlat route (as shown above), processing does not stop and continues to the toXlat endpoint which I don't want.

      But even if I do that, I can't seem to get the onException triggered in the MessageProcessor route.

       

      Second, I need the first part fixed because I expect the status to be set to Error.

      Or at least for teeXchg.getError or getFault to be set, but they always seem to be set to null.

       

      What am I doing wrong?

        • 1. Re: How do I propogate an exception up a route?
          davsclaus

          What version of SMX and Camel are you using?

           

          Have you tried with latest versions?

           

          And is it an exception or fault that is triggering the error?

           

          Have you use the Camel tracer to see what is happening and what data the Exchange contains during routing?

          http://camel.apache.org/tracer

          • 2. Re: How do I propogate an exception up a route?
            futuredan

            I am using SMX 4.3.0-fuse-03-00.   I believe that is the latest version.

            Camel version appears to be 2.4.0.fuse-02-00.  I have not updated from the version that comes with SMX.

             

            The exception is the following:

            net.sf.saxon.trans.XPathException: An empty sequence is not allowed as the first argument

             

            This is due to a bug in my xslt.  I have fixed it, but I want to set up the route so that future unknown bugs are caught.

             

            I have not used the tracer.

            What should I be looking for in the trace?

            • 3. Re: How do I propogate an exception up a route?
              futuredan

              The Tracer doesn't seem to provide any useful information.

              I added an onException clause to the external route.

              That clause sends processing to a route that logs the exception occurred.

              However, nothing shows up in the Tracer to indicate the Tracer detected the exception.