mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
limit scope of try block
This commit is contained in:
parent
dddb9f3d28
commit
0bf807f01e
1 changed files with 12 additions and 12 deletions
|
|
@ -82,26 +82,26 @@ private ActionBlock<ListInfo> BuildDownloader(CancellationToken cancellationToke
|
|||
async l =>
|
||||
{
|
||||
var errorMessage = $"Error downloading list {l.Id} from {l.ViewUrl}.";
|
||||
try
|
||||
var extension = l.ViewUrl.GetExtension();
|
||||
if (CommandsByExtension.ContainsKey(extension))
|
||||
{
|
||||
var extension = l.ViewUrl.GetExtension();
|
||||
if (CommandsByExtension.ContainsKey(extension))
|
||||
var command = CommandsByExtension[extension].Invoke(l);
|
||||
try
|
||||
{
|
||||
var command = CommandsByExtension[extension].Invoke(l);
|
||||
await _mediator.Send(command, cancellationToken);
|
||||
}
|
||||
else
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
_logger.LogError($"The file extension of list {l.Id} from {l.ViewUrl} is not supported.");
|
||||
_logger.LogError(ex, errorMessage);
|
||||
}
|
||||
catch (TaskCanceledException ex)
|
||||
{
|
||||
_logger.LogError(ex, errorMessage);
|
||||
}
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
else
|
||||
{
|
||||
_logger.LogError(ex, errorMessage);
|
||||
}
|
||||
catch (TaskCanceledException ex)
|
||||
{
|
||||
_logger.LogError(ex, errorMessage);
|
||||
_logger.LogError($"The file extension of list {l.Id} from {l.ViewUrl} is not supported.");
|
||||
}
|
||||
},
|
||||
new ExecutionDataflowBlockOptions {MaxDegreeOfParallelism = MaxDegreeOfParallelism}
|
||||
|
|
|
|||
Loading…
Reference in a new issue