You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/06/20 02:37:34 UTC

[GitHub] [kafka] showuon commented on a change in pull request #10794: KAFKA-12677: return not_controller error in envelope response itself

showuon commented on a change in pull request #10794:
URL: https://github.com/apache/kafka/pull/10794#discussion_r654866143



##########
File path: clients/src/main/java/org/apache/kafka/common/requests/ApiError.java
##########
@@ -36,10 +37,16 @@
     private final String message;
 
     public static ApiError fromThrowable(Throwable t) {
+        Throwable throwableToBeEncode = t;
+        // Future will wrap the original exception with completionException, which will return unexpected UNKNOWN_SERVER_ERROR.
+        if (t instanceof CompletionException) {
+            throwableToBeEncode = t.getCause();

Review comment:
       fix 1: unwrap the `CompletionException` to get the original exception inside. Even if we don't want the `NotControllerException` return back to client, we need to know it to do some check.

##########
File path: clients/src/main/java/org/apache/kafka/common/requests/ApiError.java
##########
@@ -36,10 +37,16 @@
     private final String message;
 
     public static ApiError fromThrowable(Throwable t) {
+        Throwable throwableToBeEncode = t;
+        // Future will wrap the original exception with completionException, which will return unexpected UNKNOWN_SERVER_ERROR.
+        if (t instanceof CompletionException) {
+            throwableToBeEncode = t.getCause();

Review comment:
       fix 1: unwrap the CompletionException to get the original exception inside.




-- 
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:
users@infra.apache.org