[ 
https://issues.apache.org/jira/browse/CAMEL-20778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Denis Istomin updated CAMEL-20778:
----------------------------------
    Summary: Intercept created using AdviceWithRouteBuilder causes issues with 
error handling (regression)  (was: Intercept created using 
AdviceWithRouteBuilder causes issues with error handling)

> Intercept created using AdviceWithRouteBuilder causes issues with error 
> handling (regression)
> ---------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-20778
>                 URL: https://issues.apache.org/jira/browse/CAMEL-20778
>             Project: Camel
>          Issue Type: Bug
>            Reporter: Denis Istomin
>            Priority: Major
>
> Starting from Camel 4.0.0
> Reproducer: [https://github.com/DenisIstomin/camel-intercept-bug]
> If route is configured like this:
> {code:java}
>     public void configure() {
>         onException(Exception.class)
>                 .log(LoggingLevel.ERROR, "handler", "called");
>         from("direct:start").routeId("main-route-id")
>           .doTry()
>             .throwException(new Exception())
>           .doCatch(Exception.class)
>             .setBody(constant("expected"))
>           .end();
>     }
> {code}
> And then this route is adviced:
> {code:java}
>         AdviceWith.adviceWith(context, "main-route-id", routeBuilder -> {
>             routeBuilder.intercept().log("intercepted");
>         });
> {code}
>  
> Error handler will not catch an exception. Body will not be equal to 
> "expected".
> XML:
> {code:xml}
> <route xmlns="http://camel.apache.org/schema/spring"; id="main-route-id">
>     <from uri="direct:start"/>
>     <onException>
>         <exception>java.lang.Exception</exception>
>         <log logName="handler" message="called" loggingLevel="ERROR"/>
>     </onException>
>     <intercept>
>         <log message="intercepted"/>
>     </intercept>
>     <doTry>
>         <throwException/>
>         <doCatch>
>             <exception>java.lang.Exception</exception>
>             <setBody>
>                 <constant>expected</constant>
>             </setBody>
>         </doCatch>
>     </doTry>
> </route>
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to