#577 Расширить фабрику клиентов Persistance #8

Merged
on.nemtina merged 11 commits from ClientFactory into master 2024-12-13 09:43:40 +05:00
Showing only changes of commit 7f377fc14b - Show all commits

View File

@ -25,9 +25,11 @@ public static class ExceptionsHelper
public static Exception GetPersistenceException(this IApiResponse response) public static Exception GetPersistenceException(this IApiResponse response)
{ {
var exception = ExceptionsDictionary ExceptionsDictionary

Обращайся к словарю через TryGetValue.

Обращайся к словарю через TryGetValue.
.FirstOrDefault(e => e.Key == response.StatusCode).Value ?? new Exception("Неопознанная ошибка"); .TryGetValue(response.StatusCode, out var exception);
return exception; var result = exception ?? new Exception("Неопознанная ошибка");
return result;
} }
} }