Update downloading

pull/408/head
NextTurn 2019-04-07 00:00:00 +08:00
parent ad329b60ca
commit bf09ea36f9
No known key found for this signature in database
GPG Key ID: 17A0D50ADDE1A0C4
1 changed files with 21 additions and 12 deletions

View File

@ -211,7 +211,13 @@ namespace winsw
tasks[i] = download.PerformAsync();
}
Task.WhenAll(tasks);
try
{
Task.WaitAll(tasks);
}
catch (AggregateException e)
{
List<Exception> exceptions = new List<Exception>(e.InnerExceptions.Count);
for (int i = 0; i < tasks.Length; i++)
{
if (tasks[i].IsFaulted)
@ -225,10 +231,13 @@ namespace winsw
// TODO: move this code into the download logic
if (download.FailOnError)
{
throw new IOException(errorMessage, exception);
exceptions.Add(new IOException(errorMessage, exception));
}
}
}
throw new AggregateException(exceptions);
}
#else
foreach (Download download in _descriptor.Downloads)
{