Hi Thomas

Good spot. Could you create a JIRA ticket for the bug?
I would assume that Camel *always* should handle any exception occurred using 
the LoggingErrorHandler. However this error handler is seldom used so that 
could be why it hasn't been spotted before.

The LoggingErrorHandler should also check for exchange.getException is not null 
and if so there is also something to be logged.


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Tomasz Domzal [mailto:[EMAIL PROTECTED] 
Sent: 6. august 2008 18:40
To: [email protected]
Subject: Exception is not logged or handled when error handler is 
LoggingErrorHandler and processing occurs inside Pipeline


Hi,

I'm trying to implement consistent exception logging in camel application 
and have problem with loggingErrorHandler when exception is thrown inside
Pipeline. 
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.

http://www.nabble.com/file/p18855167/ExceptionHandlingWithLoggingHanderAndPipelineTest.java
ExceptionHandlingWithLoggingHanderAndPipelineTest.java 

After some digging inside source code I noticed Pipeline source code
fragment 
in which exception is never returned even if internal processing thrown
exception.

    public void process(Exchange exchange) throws Exception {
        AsyncProcessorHelper.process(this, exchange);
    }

Instead it passes exception information in exchange object properties.
Problem is LoggingErrorHandler doesn't use it correctly because (code
snipped from LoggingErrorHandler):

    public void process(Exchange exchange) throws Exception {
        try {
            output.process(exchange);
        } catch (Throwable e) {
            if (!customProcessorForException(exchange, e)) {
                logError(exchange, e);
            }
        }
    }

it is logging only exception returned directly by output.process call.

Is it intended behavior ? 
Because it makes LoggingErrorHandler not working.
If it's not the way it should work do you think it's LoggingErrorHandler
problem ?
Or maybe Pipeline should behave like any other Processor and re-throw
Exception ?

Regards,
Tomek

-- 
View this message in context: 
http://www.nabble.com/Exception-is-not-logged-or-handled-when-error-handler-is-LoggingErrorHandler-and-processing-occurs-inside-Pipeline-tp18855167s22882p18855167.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to