diff --git a/Kyoo.Common/Models/Exceptions/MissingDependencyException.cs b/Kyoo.Common/Models/Exceptions/MissingDependencyException.cs deleted file mode 100644 index b2a4aa43..00000000 --- a/Kyoo.Common/Models/Exceptions/MissingDependencyException.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; - -namespace Kyoo.Models.Exceptions -{ - /// - /// An exception raised when a plugin requires dependencies that can't be found with the current configuration. - /// - [Serializable] - public class MissingDependencyException : Exception - { - /// - /// Create a new with a custom message - /// - /// The name of the plugin that can't be loaded. - /// The name of the missing dependency. - public MissingDependencyException(string plugin, string dependency) - : base($"No {dependency} are available in Kyoo but the plugin {plugin} requires it.") - {} - } -} \ No newline at end of file diff --git a/Kyoo/Controllers/PluginManager.cs b/Kyoo/Controllers/PluginManager.cs index 27a5b4bc..eaf08b97 100644 --- a/Kyoo/Controllers/PluginManager.cs +++ b/Kyoo/Controllers/PluginManager.cs @@ -4,7 +4,6 @@ using System.IO; using System.Linq; using System.Reflection; using System.Runtime.Loader; -using Kyoo.Models.Exceptions; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -106,8 +105,8 @@ namespace Kyoo.Controllers if (missing == null) return true; - Exception error = new MissingDependencyException(plugin.Name, missing.Name); - _logger.LogCritical(error, "A plugin's dependency could not be met"); + _logger.LogCritical("No {Dependency} available in Kyoo but the plugin {Plugin} requires it", + missing.Name, plugin.Name); return false; })); diff --git a/Kyoo/CoreModule.cs b/Kyoo/CoreModule.cs index 8bad71e9..f7d5dea5 100644 --- a/Kyoo/CoreModule.cs +++ b/Kyoo/CoreModule.cs @@ -48,7 +48,20 @@ namespace Kyoo }; /// - public ICollection Requires => ArraySegment.Empty; + public ICollection Requires => new [] + { + typeof(ILibraryRepository), + typeof(ILibraryItemRepository), + typeof(ICollectionRepository), + typeof(IShowRepository), + typeof(ISeasonRepository), + typeof(IEpisodeRepository), + typeof(ITrackRepository), + typeof(IPeopleRepository), + typeof(IStudioRepository), + typeof(IGenreRepository), + typeof(IProviderRepository) + }; /// public void Configure(IServiceCollection services, ICollection availableTypes)