david-streamlio commented on a change in pull request #10270:
URL: https://github.com/apache/pulsar/pull/10270#discussion_r616257284



##########
File path: 
pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java
##########
@@ -337,16 +344,18 @@ private void processResult(Record srcRecord,
         });
     }
 
-    private void sendOutputMessage(Record srcRecord, Object output) {
+    private void sendOutputMessage(Record srcRecord, Object output) throws 
Exception {
         if (!(this.sink instanceof PulsarSink)) {
             Thread.currentThread().setContextClassLoader(functionClassLoader);
         }
         try {
             this.sink.write(new SinkRecord<>(srcRecord, output));
         } catch (Exception e) {
+               if (stats != null) {
+              stats.incrSinkExceptions(e);
+               }
             log.info("Encountered exception in sink write: ", e);
-            stats.incrSinkExceptions(e);
-            throw new RuntimeException(e);
+            throw e;

Review comment:
       Avoid wrapping the real exception with a new Exception type. It just 
hides the real issue




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

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


Reply via email to