You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Michael Rambichler (Jira)" <ji...@apache.org> on 2022/06/07 12:35:00 UTC

[jira] [Created] (CAMEL-18169) setException as for Camel DSL

Michael Rambichler created CAMEL-18169:
------------------------------------------

             Summary: setException as for Camel DSL
                 Key: CAMEL-18169
                 URL: https://issues.apache.org/jira/browse/CAMEL-18169
             Project: Camel
          Issue Type: New Feature
          Components: came-core
            Reporter: Michael Rambichler


For convinience I would like to have camel dsl extended with following method:

*.setException(..)*

 

Then the following example would be one liner.

 

*Example:*

.doTry()
    // try something
.endDoTry()
doCatch(Exception.class)
   // Set the exception after our compensation logic is performed in order for the route error handler to kick in.
                    .process(exchange -> {
                        Exception exception = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
                        if (exception != null) {
                            exchange.setException(exception);
                        }
                    })
.end();

 



--
This message was sent by Atlassian Jira
(v8.20.7#820007)