/// <summary> /// 如果返回值是错误则抛出RPC异常 /// </summary> /// <param name="basicReturn">基本返回</param> public static void ThrowReturnFailureRpcException(this BasicReturnInfo basicReturn) { if (basicReturn == null || basicReturn.Success()) { return; } new BusinessException(basicReturn.Code, basicReturn.Msg, basicReturn.Desc).ThrowRpcException(basicReturn.Msg); }
/// <summary> /// 拦截 /// </summary> /// <param name="invocation">拦截参数</param> public void Intercept(IInvocation invocation) { bool isExecProceeded; BasicReturnInfo returnInfo = InterceptOperation(invocation, out isExecProceeded); if (returnInfo.Success()) { if (isExecProceeded) { return; } invocation.Proceed(); return; } SetErrMsg(invocation, returnInfo); }