You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/02/15 08:38:49 UTC

[GitHub] [camel] lburgazzoli commented on a change in pull request #5088: core: set the error handler to RouteDefinition

lburgazzoli commented on a change in pull request #5088:
URL: https://github.com/apache/camel/pull/5088#discussion_r576019406



##########
File path: core/camel-core-model/src/main/java/org/apache/camel/model/RoutesDefinition.java
##########
@@ -192,9 +192,18 @@ public RouteDefinition from(EndpointConsumerBuilder endpoint) {
      * @return       the builder
      */
     public RouteDefinition route(RouteDefinition route) {
+        // must set the error handler if not already set on the route
+        if (route.getErrorHandlerFactory() != null && route.getErrorHandlerRef() != null) {
+            ErrorHandlerFactory handler = getErrorHandlerFactory();
+            if (handler != null) {
+                route.setErrorHandlerFactory(handler);
+            }
+        }

Review comment:
       @davsclaus I'm not sure if this is actually correct but if a route is added using a `RouteDefinition`, the error handler set on the route collection is not propagated to the route which leads to different behavior depending to which method you'd use. This is probably not supposed to be used by developers but it is needed for my YAML DSL work.
   
   Let me know if there is a better way.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org