diff --git a/src/InterfaceForward.Application/Services/InterfaceForwardCommon.cs b/src/InterfaceForward.Application/Services/InterfaceForwardCommon.cs index 3588790..99d023a 100644 --- a/src/InterfaceForward.Application/Services/InterfaceForwardCommon.cs +++ b/src/InterfaceForward.Application/Services/InterfaceForwardCommon.cs @@ -125,8 +125,6 @@ public class InterfaceForwardCommon( Debug.Assert(context.TargetInterface.FlowCode != null, "context.TargetInterface.FlowCode != null"); var flow = GetForwardFlow(context.TargetInterface.FlowCode); - if (flow == default) - throw new BusinessException(message: "找不到接口转发流程" + context.TargetInterface.FlowCode); _flows.Add(context.TargetInterface.Code, flow); res.Add(context); @@ -141,8 +139,11 @@ public class InterfaceForwardCommon( // 优先用服务商接口指定流程,其次使用服务商的,再其次是默认的 public IForwardFlow GetForwardFlow(string flowCode) { - return serviceProvider.GetServices() - .FirstOrDefault(x => x.GetType().Name == flowCode)?? throw new BusinessException("未找到流程模版,请联系开发"); + var flow = serviceProvider.GetServices() + .FirstOrDefault(x => x.GetType().Name == flowCode); + if (flow == null) + throw new BusinessException(message: "找不到接口转发流程" + flowCode); + return flow; } /// @@ -205,10 +206,6 @@ public class InterfaceForwardCommon( { Debug.Assert(cacheContext.ServiceProviderAuthInterface != null, "cacheContext.ServiceProviderAuthInterface != null"); var flow = GetForwardFlow(cacheContext.ServiceProviderAuthInterface.TargetInterface.FlowCode!); - if (flow == default) - throw new BusinessException(message: "找不到接口转发流程" + - cacheContext.ServiceProviderAuthInterface.TargetInterface - .FlowCode); _flows.Add(cacheContext.ServiceProviderAuthInterface.TargetInterface.Code, flow); }