mirror of
https://github.com/g3rv4/GetMoarFediverse.git
synced 2024-11-24 16:43:17 +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;
|
var (site, tag) = st;
|
||||||
Console.WriteLine($"Fetching tag #{tag} from {site}");
|
Console.WriteLine($"Fetching tag #{tag} from {site}");
|
||||||
var response = await client.GetAsync($"https://{site}/tags/{tag}.json");
|
HttpResponseMessage? response = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
response = await client.GetAsync($"https://{site}/tags/{tag}.json");
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user