AlbumenJ commented on issue #10314:
URL: https://github.com/apache/dubbo/issues/10314#issuecomment-1183013779

   You can try this.
   
   ```
   @Activate(group = CommonConstants.PROVIDER)
   public class ResultConvertFilter implements Filter, 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) {
           if (appResponse.hasException()) {
               // reset value
               appResponse.setValue(new Object());
               appResponse.setException(null);
           } else {
               Object originValue = appResponse.getValue();
               if (originValue instanceof Exception) {
                   // reset value
                   appResponse.setValue(new Object());
               }
           }
       }
   
       @Override
       public void onError(Throwable t, Invoker<?> invoker, Invocation 
invocation) {
           // framework error, can be ignore
       }
   }
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to