davsclaus opened a new pull request, #27019: URL: https://github.com/apache/camel/pull/27019
Fixes [CAMEL-25113](https://issues.apache.org/jira/browse/CAMEL-25113): bugs found in a deep review of the onException configuration. ## Fixed 1. **The `onWhen` predicate of `onException` is now created when the route is created.** Before, it was evaluated from the model at runtime, unlike `handled`, `continued`, `retryWhile` and the `onWhen` of other EIPs. As a result: - property placeholders of route templates in the `onWhen` failed at runtime; - an invalid `onWhen` expression was only detected when an exception was thrown. 2. **An `onException` configured only with `redeliveryPolicyRef` (or `onExceptionOccurredRef`) no longer fails with "is not configured".** CAMEL-11080 only fixed this for the `redeliveryPolicy` object. 3. **A class name in `onException` that is not an exception** (such as `java.lang.String` in XML/YAML) now fails when the route is created. Before, it was accepted and never matched. ## Documentation - **`exception-clause.adoc` now describes how Camel actually selects the `onException`:** - the closest match wins, across the thrown exception and all its causes; - when two clauses are equally close, the match on the most nested cause wins; - a route-scoped `onException` wins over a context-scoped one when they are equally close; - when the same exception is configured more than once, the last one is used, and the ones from route configurations are added after those in the RouteBuilder. The old text said the first match wins, walking up from the most nested cause. - **`exception-redelivery.adoc`:** when any redelivery option is configured on an `onException`, its redelivery policy is based on the error handler's and uses its `maximumRedeliveries`. ## Tests - **New `OnExceptionReifierEdgeCasesTest`:** all 4 tests fail without the fix. - **Full camel-core suite:** passes. _Claude Code on behalf of Claus Ibsen_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
