mirror of
https://github.com/g3rv4/GetMoarFediverse.git
synced 2024-11-28 10:33:14 +01:00
catch errors pulling data from other instances
This commit is contained in:
parent
f38c7ec00d
commit
0c7589c177
@ -36,14 +36,15 @@ await Parallel.ForEachAsync(sitesTags, parallelOptions, async (st, _) =>
|
||||
{
|
||||
var (site, tag) = st;
|
||||
Console.WriteLine($"Fetching tag #{tag} from {site}");
|
||||
var response = await client.GetAsync($"https://{site}/tags/{tag}.json");
|
||||
HttpResponseMessage? response = null;
|
||||
try
|
||||
{
|
||||
response = await client.GetAsync($"https://{site}/tags/{tag}.json");
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine($"Error fetching tag, status code: {response.StatusCode}. Error: {e.Message}");
|
||||
Console.WriteLine($"Error fetching tag, status code: {response?.StatusCode}. Error: {e.Message}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user