gemini-code-assist[bot] commented on code in PR #39115:
URL: https://github.com/apache/beam/pull/39115#discussion_r3476901862


##########
runners/direct-java/src/main/java/org/apache/beam/runners/direct/ExecutorServiceParallelExecutor.java:
##########
@@ -348,17 +348,23 @@ private void shutdownIfNecessary(State newState) {
     } catch (final Exception e) {
       errors.add(e);
     }
-    pipelineState.compareAndSet(State.RUNNING, newState); // ensure we hit a 
terminal node
-    if (!errors.isEmpty()) {
-      final IllegalStateException exception =
-          new IllegalStateException(
-              "Error"
-                  + (errors.size() == 1 ? "" : "s")
-                  + " during executor shutdown:\n"
-                  + errors.stream()
-                      .map(Exception::getMessage)
-                      .collect(Collectors.joining("\n- ", "- ", "")));
-      visibleUpdates.failed(exception);
+    IllegalStateException exception = null;
+    try {
+      if (!errors.isEmpty()) {
+        exception =
+            new IllegalStateException(
+                "Error"
+                    + (errors.size() == 1 ? "" : "s")
+                    + " occurred during pipeline execution:\\n"
+                    + errors.stream()
+                        .map(e -> e.getMessage() == null ? 
e.getClass().getName() : e.getMessage())
+                        .collect(Collectors.joining("\\n- ", "- ", "")));

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The newline character is double-escaped as `\\n` instead of `\n`. This will 
cause the error message to print literal `\n` characters instead of actual 
newlines, making the output hard to read.
   
   ```suggestion
                       + " occurred during pipeline execution:\n"
                       + errors.stream()
                           .map(e -> e.getMessage() == null ? 
e.getClass().getName() : e.getMessage())
                           .collect(Collectors.joining("\n- ", "- ", "")));
   ```



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