mimaison commented on code in PR #15558:
URL: https://github.com/apache/kafka/pull/15558#discussion_r1559584216


##########
connect/mirror/src/main/java/org/apache/kafka/connect/mirror/MirrorUtils.java:
##########
@@ -320,4 +323,21 @@ static void createCompactedTopic(String topicName, short 
partitions, short repli
     static void createSinglePartitionCompactedTopic(String topicName, short 
replicationFactor, Admin admin) {
         createCompactedTopic(topicName, (short) 1, replicationFactor, admin);
     }
+
+    static <T> T adminCall(Callable<T> callable, Supplier<String> errMsg)
+            throws ExecutionException, InterruptedException {
+        try {
+            return callable.call();
+        } catch (ExecutionException | InterruptedException e) {
+            Throwable cause = e.getCause();
+            if (cause instanceof TopicAuthorizationException ||
+                    cause instanceof ClusterAuthorizationException ||
+                    cause instanceof GroupAuthorizationException) {
+                log.error("Authorization error occurred while trying to " + 
errMsg.get());

Review Comment:
   Could we do something like:
   ```
   log.error(cause.getClass().getSimpleName() + " occurred while trying to " + 
errMsg.get());
   ```
   so the exact exception is printed.



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