On Wed, Jun 6, 2012 at 8:34 PM, pvenini <pven...@mervaros.com.ar> wrote:
> Hi,
> I've a situation where a route can throw many kinds of exceptions, say A, B,
> and C. If exception is class A I should let it pass; if it's any other kind
> of exception I should throw a new exception of class A.
>
> doTry().
>  .
>  .
>  .
> doCatch(A.class).
>  //Let it pass forward
> doCatch(Exception.class).
>  throwException(new A("Some message", false)).
> stop();
>
> I'm having problems with the first situation (let the original exception A
> go forward); I tried to use handled(false) but it says it's deprecated, so I
> chose to use throwException(). However I' don't know how to get the original
> exception or if that's is impossible, how to get the text from the original
> exception and create a new one (tried to use exceptionMessage but I don't
> know how to convert a ValueBuilder to a String).
>
> Any help would be appreciated.
>

The caused exception is stored as a property on the Exchange with the
key Exchange.EXCEPTION_CAUGHT.

The simple expression can grab it easily
 throwException(simple("${exception}")).

See details at
http://camel.apache.org/simple

> Pablo
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Rethrow-original-exception-tp5714087.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to