diff --git a/Falcon.SugarApi/Plugin/Service/IServiceCollectionExtend.cs b/Falcon.SugarApi/Plugin/Service/IServiceCollectionExtend.cs index c34b6f4..b20cf3e 100644 --- a/Falcon.SugarApi/Plugin/Service/IServiceCollectionExtend.cs +++ b/Falcon.SugarApi/Plugin/Service/IServiceCollectionExtend.cs @@ -2,7 +2,6 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using System; -using System.Collections.Generic; using System.IO; using System.Reflection; @@ -25,6 +24,7 @@ namespace Falcon.SugarApi.Plugin.Service /// 服务集合 /// 应用程序配置 /// 插件名称数组 + /// /// 服务集合 public static IServiceCollection AddPluginService(this IServiceCollection services,IConfiguration config,params string[] pluginNames) { var name = typeof(IServicePlugin).FullName; @@ -63,6 +63,7 @@ namespace Falcon.SugarApi.Plugin.Service /// 服务集合 /// 应用程序配置 /// 插件程序集数组 + /// /// 服务集合 public static IServiceCollection AddPluginService(this IServiceCollection services,IConfiguration config,params Assembly[] plugins) { var name = typeof(IServicePlugin).FullName; @@ -86,7 +87,7 @@ namespace Falcon.SugarApi.Plugin.Service obj.AddServices(services,config); } catch(Exception ex) { - throw new Exception($"调用插件{type.FullName}.IServicePlugin.AddServices]方法时发生异常。",ex); + throw new PluginExecAddServicesException(type,ex); } } } diff --git a/Falcon.SugarApi/Plugin/Service/PluginExecAddServicesException.cs b/Falcon.SugarApi/Plugin/Service/PluginExecAddServicesException.cs new file mode 100644 index 0000000..d751eef --- /dev/null +++ b/Falcon.SugarApi/Plugin/Service/PluginExecAddServicesException.cs @@ -0,0 +1,19 @@ +using System; + +namespace Falcon.SugarApi.Plugin.Service +{ + /// + /// 插件执行AddServices方法时发生错误 + /// + public class PluginExecAddServicesException:Exception + { + /// + /// 通过插件类型和异常类型引发异常 + /// + /// 插件注册类型 + /// 已发的异常 + public PluginExecAddServicesException(Type type,Exception innExecption) + : base($"调用插件{type.FullName}.IServicePlugin.AddServices]方法时发生异常。",innExecption) { + } + } +}