camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tomasz Domzal (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CAMEL-792) Exception is not logged or handled when error handler is LoggingErrorHandler and processing occurs inside Pipeline
Date Mon, 11 Aug 2008 08:19:52 GMT

    [ https://issues.apache.org/activemq/browse/CAMEL-792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44895#action_44895
] 

Tomasz Domzal commented on CAMEL-792:
-------------------------------------

Attached patch for LoggingErrorHandler and verifying test case (new file).

Two doubts:

1)
Inside LoggingErrorHandler, before passing to handling exception cause is moved to exchange
property.
Is that correct ?

{code:java}
public void process(Exchange exchange) throws Exception {
	try {
		output.process(exchange);
	} catch (Throwable e) {
		exchange.setException(e);
	}
	if (exchange.getException()!=null) {

		// move exchange exception cause to property
		Throwable e = exchange.getException();
		exchange.setProperty(DeadLetterChannel.EXCEPTION_CAUSE_PROPERTY, e);
		exchange.setException(null);

		if (!customProcessorForException(exchange, e)) {
			logError(exchange, e);
		}

		// restore exception on exchange
		exchange.setException((Throwable)exchange.getProperty(DeadLetterChannel.EXCEPTION_CAUSE_PROPERTY));
	}
}
{code}
2)
Inside test case.
When defining exception enclusure in path DSL definition I used 'end()' element to close 'exception
handling' subpath.
(without 'end()' exception handling is not working at all.)
Is that correct ?
{code:java}
from(...)
	.exception(SomeException.class).to(...).end()
	.process(...)
	.to(...);
{code}

> Exception is not logged or handled when error handler is LoggingErrorHandler and processing
occurs inside Pipeline
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-792
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-792
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.4.0
>         Environment: camel-core-1.4.0.0-fuse. 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,
ExceptionHandlingWithLoggingHanderAndPipelineTest.java
>
>
> 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.


Mime
View raw message