Mike Kobler created CAMEL-22529:
-----------------------------------

             Summary: camel-core: onException doesn't work as expected
                 Key: CAMEL-22529
                 URL: https://issues.apache.org/jira/browse/CAMEL-22529
             Project: Camel
          Issue Type: Bug
          Components: came-core
    Affects Versions: 4.10.7
            Reporter: Mike Kobler


When using a RouteConfigurationBuilder with multiple onException blocks, Apache 
Camel incorrectly matches the thrown exception to the wrong handler.

 
{code:java}
public class Xyz extends RouteConfigurationBuilder {
  @Override
  public void configuration() throws Exception {
    routeConfiguration()
      .onException(HttpOperationFailedException.class)
        .log(LoggingLevel.ERROR, "Test HttpOperationFailedException: 
${exception}")
      .onException(Exception.class)
        .log(LoggingLevel.ERROR, "Test Exception: ${exception}")
      ;
  }
}{code}
This example outputs "Test HttpOperationFailedException: java.lang.Exception" 
when java.lang.Exception is thrown. Expected result would be "Test Exception: 
java.lang.Exception"

Am I doing something wrong or is this a bug?

 



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

Reply via email to