Claus Ibsen created CAMEL-25113:
-----------------------------------

             Summary: camel-core - onException configuration: fix bugs found in 
a deep review
                 Key: CAMEL-25113
                 URL: https://issues.apache.org/jira/browse/CAMEL-25113
             Project: Camel
          Issue Type: Bug
          Components: camel-core
            Reporter: Claus Ibsen


A review of the onException configuration found these bugs:

# The {{onWhen}} predicate of {{onException}} is not created when the route is 
created (unlike {{handled}}, {{continued}}, {{retryWhile}} and the onWhen of 
other EIPs), but evaluated from the model at runtime. So property placeholders 
of route templates in the onWhen fail at runtime ({{Property with key [code] 
not found}}), and an invalid onWhen expression is not detected when the route 
is created but only when an exception is thrown.
# An {{onException}} that is only configured with {{redeliveryPolicyRef}} (or 
{{onExceptionOccurredRef}}) fails with {{is not configured}} (CAMEL-11080 only 
fixed this for the redeliveryPolicy object).
# A class name in {{onException}} that is not an exception (such as 
{{java.lang.String}} in XML/YAML) is accepted and never matches; it now fails 
when the route is created.

Documentation:
* How Camel selects the onException is described as "first match starting from 
the bottom (nested caused by)", but Camel selects the closest match across the 
thrown exception and all its causes (and the most nested one when equally 
close), a route scoped onException wins over a context scoped when equally 
close, and when the same exception is configured more than once the last one is 
used (and the ones from route configurations are added after the ones in the 
RouteBuilder).
* When any redelivery option is configured on an onException, its redelivery 
policy is based on the error handler (and uses its maximumRedeliveries).

_Claude Code on behalf of Claus Ibsen_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to