From 7f377fc14b7e55647798d4b5f7074487d4cf36cb Mon Sep 17 00:00:00 2001 From: Roman Efremov Date: Thu, 12 Dec 2024 11:56:20 +0500 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=BD=D0=B5=D1=81=D1=82=D0=B8=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BA=D1=83=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5?= =?UTF-8?q?=20=D1=80=D0=B5=D0=B2=D1=8C=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Persistence.Client/Helpers/ExceptionsHelper.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Persistence.Client/Helpers/ExceptionsHelper.cs b/Persistence.Client/Helpers/ExceptionsHelper.cs index 8c349ba..0e3a31a 100644 --- a/Persistence.Client/Helpers/ExceptionsHelper.cs +++ b/Persistence.Client/Helpers/ExceptionsHelper.cs @@ -25,9 +25,11 @@ public static class ExceptionsHelper public static Exception GetPersistenceException(this IApiResponse response) { - var exception = ExceptionsDictionary - .FirstOrDefault(e => e.Key == response.StatusCode).Value ?? new Exception("Неопознанная ошибка"); + ExceptionsDictionary + .TryGetValue(response.StatusCode, out var exception); - return exception; + var result = exception ?? new Exception("Неопознанная ошибка"); + + return result; } }