mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Ignore bad json files when loading repos
This commit is contained in:
parent
85fa3d2c99
commit
9ee8bd8cd9
@ -7,6 +7,7 @@ using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Reactive.Subjects;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
@ -198,14 +199,25 @@ public class Client
|
||||
var featured = await LoadFeaturedLists();
|
||||
|
||||
return await (await repos).PMapAll(async url =>
|
||||
(await _client.GetFromJsonAsync<ModlistMetadata[]>(_limiter,
|
||||
{
|
||||
try
|
||||
{
|
||||
return (await _client.GetFromJsonAsync<ModlistMetadata[]>(_limiter,
|
||||
new HttpRequestMessage(HttpMethod.Get, url.Value),
|
||||
_dtos.Options))!.Select(meta =>
|
||||
{
|
||||
meta.RepositoryName = url.Key;
|
||||
meta.Official = (meta.RepositoryName == "wj-featured" || featured.Contains(meta.NamespacedName));
|
||||
meta.Official = (meta.RepositoryName == "wj-featured" ||
|
||||
featured.Contains(meta.NamespacedName));
|
||||
return meta;
|
||||
}))
|
||||
});
|
||||
}
|
||||
catch (JsonException ex)
|
||||
{
|
||||
_logger.LogError(ex, "While loading {List} from {Url}", url.Key, url.Value);
|
||||
return Enumerable.Empty<ModlistMetadata>();
|
||||
}
|
||||
})
|
||||
.SelectMany(x => x)
|
||||
.ToArray();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user