camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: onException and .process()
Date Mon, 30 Aug 2010 11:18:43 GMT
Hi

It works fine. The problem you have is that you handle the exception,
which cases the exchange.getException() to return null.

See this unit test how to get the caused exception as a property
http://svn.apache.org/viewvc?rev=990770&view=rev



On Mon, Aug 30, 2010 at 10:24 AM, Morten Engel <me@alpha-solutions.dk> wrote:
>
> Well, what I really want to do is something along the lines of editing the
> body, to include both the original content, as well as info on the
> exception, along the lines of:
>
> public void process(Exchange exchange) {
>   Message in = exchange.getIn();
>   Exception ex = exchange.getException();
>   in.setBody("Errors found in shipped order!\r\n" + "Errors:\r\n" +
> ex.getMessage() + "\r\nInput:  \r\n"
>   + in.getBody(String.class));
> }
>
> But even if I just leave a logging statement, and don't alter anything in
> the exchange, the exception gets thrown (just after the logging statement
> has been executed).
> --
> View this message in context: http://camel.465427.n5.nabble.com/onException-and-process-tp2740331p2796463.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message