Copilot commented on code in PR #10606:
URL: https://github.com/apache/gravitino/pull/10606#discussion_r3045284608


##########
core/src/main/java/org/apache/gravitino/listener/TableEventDispatcher.java:
##########
@@ -139,9 +143,14 @@ public Table createTable(
           new CreateTableEvent(PrincipalUtils.getCurrentUserName(), ident, new 
TableInfo(table)));
       return table;
     } catch (Exception e) {
-      eventBus.dispatchEvent(
-          new CreateTableFailureEvent(
-              PrincipalUtils.getCurrentUserName(), ident, e, 
createTableRequest));
+      try {
+        eventBus.dispatchEvent(
+            new CreateTableFailureEvent(
+                PrincipalUtils.getCurrentUserName(), ident, e, 
createTableRequest));
+      } catch (Exception ex) {
+        e.addSuppressed(ex);
+        LOG.warn("Failed to dispatch CreateTableFailureEvent", ex);

Review Comment:
   `e.addSuppressed(ex)` can itself throw (IllegalArgumentException) if the 
listener rethrows the *same* exception instance that was caught as `e` (e.g., a 
listener does `throw ((CreateTableFailureEvent) event).exception()`). In that 
case the suppression attempt would mask the original createTable failure again. 
Please guard against self-suppression (and ideally wrap suppression in a safe 
try/catch) so the original exception is always rethrown.



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