AndyJiang99 commented on code in PR #3548:
URL: https://github.com/apache/gobblin/pull/3548#discussion_r975881365


##########
gobblin-utility/src/main/java/org/apache/gobblin/util/filesystem/ExceptionCatchingPathAlterationListenerDecorator.java:
##########
@@ -42,73 +45,83 @@ public Object getDecoratedObject() {
 
   @Override
   public void onStart(PathAlterationObserver observer) {
-    try {
+    logSwallowedThrowable(() -> {
       this.underlying.onStart(observer);
-    } catch (Throwable exc) {
-      log.error("onStart failure: ", exc);
-    }
+      return null;
+    });
   }
 
   @Override
   public void onFileCreate(Path path) {
-    try {
+    logSwallowedThrowable(() -> {
       this.underlying.onFileCreate(path);
-    } catch (Throwable exc) {
-      log.error("onFileCreate failure: ", exc);
-    }
+      return null;
+    });
   }
 
   @Override
   public void onFileChange(Path path) {
-    try {
+    logSwallowedThrowable(() -> {
       this.underlying.onFileChange(path);
-    } catch (Throwable exc) {
-      log.error("onFileChange failure: ", exc);
-    }
+      return null;
+    });
   }
 
   @Override
   public void onStop(PathAlterationObserver observer) {
-    try {
+    logSwallowedThrowable(() -> {
       this.underlying.onStop(observer);
-    } catch (Throwable exc) {
-      log.error("onStop failure: ", exc);
-    }
+      return null;
+    });
   }
 
   @Override
   public void onDirectoryCreate(Path directory) {
-    try {
+    logSwallowedThrowable(() -> {
       this.underlying.onDirectoryCreate(directory);
-    } catch (Throwable exc) {
-      log.error("onDirectoryCreate failure: ", exc);
-    }
+      return null;
+    });
   }
 
   @Override
   public void onDirectoryChange(Path directory) {
-    try {
+    logSwallowedThrowable(() -> {
       this.underlying.onDirectoryChange(directory);
-    } catch (Throwable exc) {
-      log.error("onDirectoryChange failure: ", exc);
-    }
+      return null;
+    });
   }
 
   @Override
   public void onDirectoryDelete(Path directory) {
-    try {
+    logSwallowedThrowable(() -> {
       this.underlying.onDirectoryDelete(directory);
-    } catch (Throwable exc) {
-      log.error("onDirectoryDelete failure: ", exc);
-    }
+      return null;
+    });
   }
 
   @Override
   public void onFileDelete(Path path) {
-    try {
+    logSwallowedThrowable(() -> {
       this.underlying.onFileDelete(path);
+      return null;
+    });
+  }
+
+  @Override
+  public void onCheckDetectedChange() {
+    logSwallowedThrowable(() -> {
+      this.underlying.onCheckDetectedChange();
+      return null;
+    });
+  }
+
+  protected void logSwallowedThrowable(Callable<Void> c) {

Review Comment:
   Ideally a better argument variable name than just `c`



-- 
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: dev-unsubscr...@gobblin.apache.org

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

Reply via email to