cadonna commented on code in PR #16663:
URL: https://github.com/apache/kafka/pull/16663#discussion_r1689372316


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamTask.java:
##########
@@ -800,35 +800,39 @@ record = null;
                 record = null;
                 throw new TaskCorruptedException(Collections.singleton(id));
             }
+        } catch (final FailedProcessingException failedProcessingException){
+            // Do not keep the failed processing exception in the stack trace
+            handleException(failedProcessingException.getCause());
         } catch (final StreamsException exception) {
             record = null;
             throw exception;
         } catch (final RuntimeException e) {
-            // Do not keep the failed processing exception in the stack trace
-            final Throwable processingException = e instanceof 
FailedProcessingException ? e.getCause() : e;
-
-            final StreamsException error = new StreamsException(
-                String.format(
-                    "Exception caught in process. taskId=%s, processor=%s, 
topic=%s, partition=%d, offset=%d, stacktrace=%s",
-                    id(),
-                    processorContext.currentNode().name(),
-                    record.topic(),
-                    record.partition(),
-                    record.offset(),
-                    getStacktraceString(processingException)
-                ),
-                processingException
-            );
-            record = null;
-
-            throw error;
+            handleException(e);
         } finally {
             processorContext.setCurrentNode(null);
         }
 
         return true;
     }
 
+    private void handleException(final Throwable e) {

Review Comment:
   Why did you change `private void handleException(final Throwable e)` to 
`private void handleException(final Exception e)`? The additional wrapping into 
an `Exception` is not worth changing the signature. Please revert  to `private 
void handleException(final Throwable e)`  and pass in 
`failedProcessingException.getCause()`.
   See my comment above.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to