You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/08/12 10:42:30 UTC

[GitHub] [dubbo] guohao commented on issue #8363: [Dubbo 3.0.1] use triple protocol cant return real exception

guohao commented on issue #8363:
URL: https://github.com/apache/dubbo/issues/8363#issuecomment-897533563


   Scenario1 :  Non-Protobuf
   Exception will be serialized and rethrowed at client side.
   Scenario2 : Protobuf
   Serialization of origin exception is not supported, insteadly  a `TripleRpcException` will be returned. Users can return and get custom error code in response's attachments like this
   ```java
   @Activate(group = {CommonConstants.CONSUMER})
   public class BizErrorCodeClientFilter implements ClusterFilter, BaseFilter.Listener {
       @Override
       public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
           return invoker.invoke(invocation);
       }
   
       @Override
       public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
           appResponse.getObjectAttachment("biz-err-code");
       }
   
       @Override
       public void onError(Throwable t, Invoker<?> invoker, Invocation invocation) {
       }
   }
   ```


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org