camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <>
Subject [jira] Commented: (CAMEL-792) Exception is not logged or handled when error handler is LoggingErrorHandler and processing occurs inside Pipeline
Date Tue, 12 Aug 2008 04:28:52 GMT


Claus Ibsen commented on CAMEL-792:

Hi Thomasz

Thanks for looking into this and providing patches and with comments as well.

Ad 1)
Ah here we get a bit confusing with Camel.

You can fail a route by:
a) throwing an exception
b) setting an exception on the exchange

case a is handled today by the logging error handler. The bug is that case b is not. The DLC
handles both cases.

What you do by setting the exception on the message is that a is now => b. I do think we
should keep the two cases separated.

Ad 2)
Ah this is not seen very often but clever. You have the exception within the from = in your
route path.
Yes the end() is needed otherwise Camel doesn't know when to stop if it goes by the exception
It doesn't know about new lines so it would just continue. With this you can do fancy stuff

Just like a regular route path. So when you have it nested you need to tell Camel when to
end this path.

If you move the exception outside then you can use the semi colon to stop ;


Then the ; is like the end()

> Exception is not logged or handled when error handler is LoggingErrorHandler and processing
occurs inside Pipeline
> ------------------------------------------------------------------------------------------------------------------
>                 Key: CAMEL-792
>                 URL:
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.4.0
>         Environment: camel-core- windows xp, java 6
>            Reporter: Tomasz Domzal
>             Fix For: 1.5.0
>         Attachments: camel-792-logging-error-handler-test-case.patch.txt, camel-792-logging-error-handler.patch.txt,
> Exception throw inside Pipeline is not reported or handled when error handler is LoggingErrorHandler.
> Attached unit test fails - exchange with exception is not passed to "mock:error" endpoints.
> Test will pass when you change error handler to default (DeadLetterErrorHandler)
> or when processor throwing an exception is processed not inside Pipeline.
> After some digging inside source code I noticed Pipeline source code fragment.
> {code:java}
>     public void process(Exchange exchange) throws Exception {
>         AsyncProcessorHelper.process(this, exchange);
>     }
> {code}
> AsyncProcessorHelper.process(..) never throws exception directly.
> Instead it passes exception information in exchange object properties.
> Problem is LoggingErrorHandler doesn't use it correctly because (code snipped from LoggingErrorHandler):
> {code:java}
>     public void process(Exchange exchange) throws Exception {
>         try {
>             output.process(exchange);
>         } catch (Throwable e) {
>             if (!customProcessorForException(exchange, e)) {
>                 logError(exchange, e);
>             }
>         }
>     }
> {code}
> it is logging only exception returned directly by output.process call.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message