You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by ea...@apache.org on 2023/04/14 09:20:39 UTC

[dubbo] branch 3.1 updated: fix tri stub exception (#12093)

This is an automated email from the ASF dual-hosted git repository.

earthchen pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.1 by this push:
     new 129b4fa2fd fix tri stub exception (#12093)
129b4fa2fd is described below

commit 129b4fa2fd5aea13a0365d696c83f723d69413c7
Author: earthchen <ea...@gmail.com>
AuthorDate: Fri Apr 14 17:20:30 2023 +0800

    fix tri stub exception (#12093)
    
    * fix tri stub exception
    
    * fix
---
 .../main/java/org/apache/dubbo/rpc/stub/UnaryStubMethodHandler.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/stub/UnaryStubMethodHandler.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/stub/UnaryStubMethodHandler.java
index f2bff904f1..81e069fa63 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/stub/UnaryStubMethodHandler.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/stub/UnaryStubMethodHandler.java
@@ -34,7 +34,11 @@ public class UnaryStubMethodHandler<T, R> implements StubMethodHandler<T, R> {
         T request = (T) arguments[0];
         CompletableFuture<R> future = new CompletableFuture<>();
         StreamObserver<R> responseObserver = new FutureToObserverAdaptor<>(future);
-        func.accept(request, responseObserver);
+        try {
+            func.accept(request, responseObserver);
+        } catch (Throwable e) {
+            future.completeExceptionally(e);
+        }
         return future;
     }
 }