davsclaus commented on code in PR #27912:
URL: https://github.com/apache/camel/pull/27912#discussion_r4287552890


##########
dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/FileCliConnectorTransport.java:
##########
@@ -237,18 +264,45 @@ private void finishAction(File request, PendingAction 
action) {
         }
     }
 
-    private static JsonObject loadAction(File file) {
+    /**
+     * The reply to an action: its result, the error, or an ack. The shared 
output file only gets the result, or the
+     * error of an exception (as before 4.24), so the next command does not 
read a reply meant for another command.
+     */
+    private static JsonObject reply(CliActionOutcome outcome, boolean 
replyAlways) {
+        if (outcome.result() != null) {
+            return outcome.result();

Review Comment:
   Fixed in 6a1aefecd098: an exception, an unknown action or a reported error 
now wins over a (partial) result. The file transport answers 
`{"status":"failed","error":"..."}` and keeps the result the action wrote 
before it failed under `"result"`, so nothing is lost and it matches the 
WebSocket frame, which sends both. (Before this PR an exception also replaced a 
partial result.) A result that reports a failure of its own, such as 
`{"status":"error","message":...}` from `cmd sql`, is still written as it is, 
because the CLI reads those. 
`FileCliConnectorTransportTest.exceptionWinsOverAPartialResult`, 
`reportedErrorWinsOverAResult` and `resultWithAFailureOfItsOwnIsWrittenAsItIs` 
cover it.
   
   _Claude Code on behalf of davsclaus_



##########
dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/LocalCliConnector.java:
##########
@@ -1461,8 +1465,12 @@ private void doActionProcessorTask(JsonObject root) {
             } catch (Exception e) {
                 LOG.warn("Error {} processor: {} due to: {}. This exception is 
ignored.", command, mp.getProcessorId(),
                         e.getMessage(), e);
+                reportError("Error " + command + " processor: " + 
mp.getProcessorId() + " due to: " + e.getMessage());

Review Comment:
   Fixed in 6a1aefecd098: the collector keeps every reported problem and joins 
them with `; ` (for example `Error stop route: a due to: x; Error stop route: b 
due to: y`), so this holds for the route action too. `reason` is `not-found` 
only when every reported problem is a not-found. 
`CliActionOutcomeTest.severalProblemsAreJoined` and 
`notFoundOnlyWhenEveryProblemIsNotFound` cover it.
   
   _Claude Code on behalf of davsclaus_



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