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


##########
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:
   @sebastienviale found that `failedProcessingException.getCause()` returns a 
`Throwable`. I think casting would be overhead. Let's keep `private void 
handleException(final Throwable e)`



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