diff --git a/DD.Persistence.Client/CustomExceptions/SettingsPropertyNotFoundException.cs b/DD.Persistence.Client/CustomExceptions/SettingsPropertyNotFoundException.cs new file mode 100644 index 0000000..6baa108 --- /dev/null +++ b/DD.Persistence.Client/CustomExceptions/SettingsPropertyNotFoundException.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DD.Persistence.Client.CustomExceptions; + +/// +/// Ошибка, которая выбрасывается в случае отсутствия необходимого свойства в appsettings.json +/// +public class AppSettingsPropertyNotFoundException : Exception +{ + /// + /// + /// + /// + public AppSettingsPropertyNotFoundException(string message) + : base(message) { } +} diff --git a/DD.Persistence.Client/DD.Persistence.Client.csproj b/DD.Persistence.Client/DD.Persistence.Client.csproj index 2395482..1d91345 100644 --- a/DD.Persistence.Client/DD.Persistence.Client.csproj +++ b/DD.Persistence.Client/DD.Persistence.Client.csproj @@ -52,7 +52,6 @@ - diff --git a/DD.Persistence.Client/RefitClientFactory.cs b/DD.Persistence.Client/RefitClientFactory.cs index 9cd0bef..28535f5 100644 --- a/DD.Persistence.Client/RefitClientFactory.cs +++ b/DD.Persistence.Client/RefitClientFactory.cs @@ -1,9 +1,8 @@ using DD.Persistence.Client.Clients.Interfaces.Refit; -using DD.Persistence.Client.Helpers; +using DD.Persistence.Client.CustomExceptions; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using Refit; -using System.Configuration; using System.Text.Json; namespace DD.Persistence.Client; @@ -26,7 +25,7 @@ public class RefitClientFactory : IRefitClientFactory where T : IRefitClie var baseUrl = configuration.GetSection("ClientUrl").Get(); if (String.IsNullOrEmpty(baseUrl)) { - var exception = new SettingsPropertyNotFoundException("В настройках конфигурации не указан адрес Persistence сервиса."); + var exception = new AppSettingsPropertyNotFoundException("В настройках конфигурации не указан адрес Persistence сервиса."); logger.LogError(exception.Message);