This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.3
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.3 by this push:
new 32336dbd8a fix: fix httpStatusToGrpcStatus always return 13
https://github.com/apache/dubbo/issues/14498 (#14563)
32336dbd8a is described below
commit 32336dbd8a5fa717f76c5ddaaf74296bc1ae8c64
Author: xingci <[email protected]>
AuthorDate: Wed Aug 21 10:14:57 2024 +0800
fix: fix httpStatusToGrpcStatus always return 13
https://github.com/apache/dubbo/issues/14498 (#14563)
Co-authored-by: haifeng.pang <[email protected]>
---
.../rpc/protocol/tri/h12/grpc/GrpcHttp2ServerTransportListener.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git
a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/grpc/GrpcHttp2ServerTransportListener.java
b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/grpc/GrpcHttp2ServerTransportListener.java
index 921c6bc3a6..ff0d90ffa1 100644
---
a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/grpc/GrpcHttp2ServerTransportListener.java
+++
b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/grpc/GrpcHttp2ServerTransportListener.java
@@ -31,6 +31,7 @@ import
org.apache.dubbo.remoting.http12.h2.Http2TransportListener;
import org.apache.dubbo.remoting.http12.message.MethodMetadata;
import org.apache.dubbo.remoting.http12.message.StreamingDecoder;
import org.apache.dubbo.rpc.RpcInvocation;
+import org.apache.dubbo.rpc.StatusRpcException;
import org.apache.dubbo.rpc.TriRpcStatus;
import org.apache.dubbo.rpc.model.FrameworkModel;
import org.apache.dubbo.rpc.model.MethodDescriptor;
@@ -69,6 +70,9 @@ public class GrpcHttp2ServerTransportListener extends
GenericHttp2ServerTranspor
private static String httpStatusToGrpcStatus(Throwable throwable) {
// http status code map to grpc status code
+ if (throwable instanceof StatusRpcException) {
+ return String.valueOf(((StatusRpcException)
throwable).getStatus().code.code);
+ }
return String.valueOf(TriRpcStatus.INTERNAL.code.code);
}