luigidemasi commented on code in PR #26684:
URL: https://github.com/apache/camel/pull/26684#discussion_r4064086368


##########
components/camel-ai/camel-jev/src/main/java/org/apache/camel/component/jev/JevUncertainResultException.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jev;
+
+import org.apache.camel.CamelException;
+
+/** A Noul probability within the predicate's configured uncertainty band. */
+public class JevUncertainResultException extends CamelException {

Review Comment:
   The wrapping observation is correct, but it does not prevent 
`onException(JevUncertainResultException.class)` from matching. Camel's 
exception policies inspect nested causes; they are not Java `catch` clauses 
that only inspect the outer exception.
   
   This is documented in [exception policy 
selection](https://github.com/apache/camel/blob/74f145e83ea7654b3dadedd22d222ac27b1025b4/docs/user-manual/modules/ROOT/pages/exception-clause.adoc#L171-L186)
 and implemented in 
[DefaultExceptionPolicyStrategy](https://github.com/apache/camel/blob/74f145e83ea7654b3dadedd22d222ac27b1025b4/core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/DefaultExceptionPolicyStrategy.java#L72-L87).
   
   I reran the exact scenario against commit 
74f145e83ea7654b3dadedd22d222ac27b1025b4 on Java 17, using a local HTTP fixture 
returning probability `0.5`, threshold `0.5`, uncertainty `0.125`, and 
`UncertaintyPolicy.Fail`:
   
   ```java
   onException(JevUncertainResultException.class)
       .handled(true).to("direct:uncertain");
   from("direct:uncertain")
       .setHeader("branch", constant("uncertain"));
   ```
   
   Filter, Choice and Validate all reached this handler. Each returned exchange 
had no unhandled exception, retained its original body and Jev result, and had 
`branch=uncertain`. The application handler did not inspect the exception or 
its cause.
   
   The documentation's cause-chain wording describes normal Camel error 
handling, not a workaround. Changing the superclass could be considered as a 
separate API preference, but it is not required to make the reported routing 
pattern work.
   
   _AI-generated by OpenAI Codex on behalf of @luigidemasi via 
/oss-address-review._
   



-- 
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]

Reply via email to