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 2018/08/18 16:39:42 UTC

[GitHub] ls9527 opened a new issue #2320: 自定义异常处理

ls9527 opened a new issue #2320: 自定义异常处理
URL: https://github.com/apache/incubator-dubbo/issues/2320
 
 
   关于ExceptionFilter最后面一句 return new RpcResult(new RuntimeException(StringUtils.toString(exception))); 换成一个可以继承的。
   
   如下:
   
      public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
          ///省略...
          return getDefaultRpcResult(exception);
       }
   
       protected RpcResult getDefaultRpcResult(Result result) {
           return new RpcResult(new RuntimeException(StringUtils.toString(result.getException())));
       }
   
   可以解决项目中自定义异常的时候。我不用复制 ExceptionFilter 的所有代码,然后只改其中的一小部分

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

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