I've updated my response in your gist.

In short, Apache Camel will create a separate Channel construct under
the covers for your advice-with route builder. This means the advice
builder won't see the try-catch at that point since the try-catch is
in a separate route. To test what you're trying to do, try using the
mock approach I mentioned above.



On Tue, Nov 19, 2013 at 7:50 AM, Christian Posta
<christian.po...@gmail.com> wrote:
> Use skipSendToOriginalEndpoint(). I left a comment on your gist.
>
> Alternatively, since you're just using a mock endpoint, you can just
> use the mock to throw the exception:
>
>         getMockEndpoint("mock:exception").whenAnyExchangeReceived(new
> Processor() {
>
>             @Override
>             public void process(Exchange exchange) throws Exception {
>                 throw new Exception("fail me");
>             }
>         });
>
>
>
> On Tue, Nov 19, 2013 at 1:38 AM, Michiel Borkent
> <michiel.bork...@finalist.nl> wrote:
>> I mean the onException block
>>
>> Michiel Borkent
>> Software Engineer
>>
>> Finalist -  open *IT* oplossingen
>> Amsterdam - Eindhoven - Maarssen - Maastricht - Rotterdam
>> *www.finalist.nl <http://www.finalist.nl/>*
>>
>>
>> 2013/11/19 Michiel Borkent <michiel.bork...@finalist.nl>
>>
>>> Hi,
>>>
>>> In the following code: https://gist.github.com/anonymous/7534990
>>> the onError block is triggered, even when I have a doTry/doCatch in my
>>> route.
>>> Is this expected behavior of camel or a bug?
>>> I want to use an onError block to handle all unhandled exceptions, but not
>>> the ones I catch myself in the route. How to do this?
>>>
>>> Kind regards,
>>>
>>> Michiel Borkent
>>>
>
>
>
> --
> Christian Posta
> http://www.christianposta.com/blog
> twitter: @christianposta



-- 
Christian Posta
http://www.christianposta.com/blog
twitter: @christianposta

Reply via email to