mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #1920 from wabbajack-tools/try-catch-validation
Add some try/catch around list validation
This commit is contained in:
commit
5558096c55
@ -137,8 +137,9 @@ public class ValidateLists : IVerb
|
||||
modListData =
|
||||
await StandardInstaller.Load(_dtos, _dispatcher, modList, token);
|
||||
}
|
||||
catch (JsonException ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Forcing down {Modlist} due to error while loading: ", modList.NamespacedName);
|
||||
validatedList.Status = ListStatus.ForcedDown;
|
||||
return validatedList;
|
||||
}
|
||||
|
@ -176,13 +176,16 @@ public class HttpDownloader : ADownloader<DTOs.DownloadStates.Http>, IUrlDownloa
|
||||
|
||||
public override async Task<byte[]> LoadChunk(long offset, int size)
|
||||
{
|
||||
var msg = HttpDownloader.MakeMessage(_state);
|
||||
msg.Headers.Range = new RangeHeaderValue(offset, offset + size);
|
||||
using var response = await _downloader._client.SendAsync(msg);
|
||||
if (!response.IsSuccessStatusCode)
|
||||
throw new HttpException(response);
|
||||
return await CircuitBreaker.WithAutoRetryAllAsync(_downloader._logger, async () =>
|
||||
{
|
||||
var msg = HttpDownloader.MakeMessage(_state);
|
||||
msg.Headers.Range = new RangeHeaderValue(offset, offset + size);
|
||||
using var response = await _downloader._client.SendAsync(msg);
|
||||
if (!response.IsSuccessStatusCode)
|
||||
throw new HttpException(response);
|
||||
|
||||
return await response.Content.ReadAsByteArrayAsync();
|
||||
return await response.Content.ReadAsByteArrayAsync();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user