Exception - artemovsergey/ASP GitHub Wiki

try-catch

{
 // ...
}
catch (Exception ex) when (
 (ex is AggregateException
 && ex.InnerException is HttpRequestException)
 || ex is HttpRequestException
 || ex is TaskCanceledException)
{
 return null;
}