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