Skip to content
Permalink
Browse files
Improve error message during ErrorHander building validation #820
  • Loading branch information
lburgazzoli committed May 6, 2022
1 parent dfdab42 commit bb3019722e98977bdd6fb06e8bcdaac2890fc702
Showing 1 changed file with 8 additions and 4 deletions.
@@ -110,10 +110,12 @@ public void afterConfigure(RouteBuilder builder) {
List<RouteTemplateDefinition> templates = builder.getRouteTemplateCollection().getRouteTemplates();

if (routes.size() != 1) {
throw new IllegalArgumentException("There should be a single route definition, got " + routes.size());
throw new IllegalArgumentException(
"There should be a single route definition when configuring route templates, got " + routes.size());
}
if (!templates.isEmpty()) {
throw new IllegalArgumentException("There should not be any template, got " + templates.size());
throw new IllegalArgumentException(
"There should not be any template definition when configuring route templates, got " + templates.size());
}

// create a new template from the source
@@ -140,10 +142,12 @@ public void afterConfigure(RouteBuilder builder) {
List<RouteTemplateDefinition> templates = builder.getRouteTemplateCollection().getRouteTemplates();

if (!routes.isEmpty()) {
throw new IllegalArgumentException("There should be no route definition, got " + routes.size());
throw new IllegalArgumentException(
"There should be no route definition when configuring error handler, got " + routes.size());
}
if (!templates.isEmpty()) {
throw new IllegalArgumentException("There should not be any template, got " + templates.size());
throw new IllegalArgumentException(
"There should not be any template definition when configuring error handler, got " + templates.size());
}

if (hasErrorHandlerBuilder(builder)) {

0 comments on commit bb30197

Please sign in to comment.