Claus Ibsen created CAMEL-24846:
-----------------------------------
Summary: camel validate yaml: an onException (or intercept,
onCompletion) placed after the routes passes validation and fails at startup
with a Java DSL message
Key: CAMEL-24846
URL: https://issues.apache.org/jira/browse/CAMEL-24846
Project: Camel
Issue Type: Improvement
Components: camel-jbang, camel-yaml-dsl
Reporter: Claus Ibsen
A YAML file with the error handler entry after the routes:
{code:yaml}
- route:
from:
uri: "timer:t?repeatCount=1"
steps:
- log: "hello"
- onException:
exception:
- java.lang.Exception
handled:
constant: "true"
steps:
- log: "handled"
{code}
validates ({{Validation success}}) and then fails at startup:
{code}
Error starting Camel: java.lang.IllegalArgumentException: onException must be
defined before any routes in the RouteBuilder
{code}
"RouteBuilder" means nothing to a YAML author. The validator sees the order of
the top-level entries and can say it before the run, in YAML words: "line 6:
onException must come before the routes: move this entry above the first -
route:". The runtime message can say the same when the source is YAML. The same
applies to intercept, interceptFrom, interceptSendToEndpoint and onCompletion.
Found in the round-2 local-model benchmark on the camel-jbang-examples ladder
(openapi-client): a validated file, a startup failure, and a round lost.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)