gnodet-bot commented on code in PR #26584:
URL: https://github.com/apache/camel/pull/26584#discussion_r4046497531


##########
components/camel-http-common/src/main/java/org/apache/camel/http/common/CamelServlet.java:
##########
@@ -373,12 +401,12 @@ private CompletionStage<?> tryAsyncProcess(
                 .whenComplete((r, ex) -> {
                     if (ex != null) {
                         exchange.setException(ex);
-                    } else {
-                        try {
-                            afterProcess(res, consumer, exchange, false);
-                        } catch (Exception e) {
-                            exchange.setException(e);
-                        }
+                    }
+                    // always write the response (error or not) and finish the 
UoW
+                    try {
+                        afterProcess(res, consumer, exchange, false);
+                    } catch (Exception e) {
+                        exchange.setException(e);

Review Comment:
   ⚠️ **Missing test for the error path.** This hunk moves `afterProcess()` 
outside the `else` branch so it runs even when the stage completes with an 
exception — that's the right fix. But neither new test exercises this path: 
both `ServletAsyncNoExecutorRefRaceTest` and `JettyAsyncDelayedRouteTest` only 
verify the success case (route delays, returns body). A test where 
`processAsync()` completes exceptionally would confirm that (a) an error 
response is actually written and (b) the `AsyncContext` is completed exactly 
once, preventing a silent regression back to the old success-only branch.



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