Log when there are exceptions

This commit is contained in:
Gervasio Marchand 2023-07-05 09:24:21 -03:00
parent e05d91d93d
commit 4bc6c10aac
No known key found for this signature in database
GPG Key ID: B7736CB188DD0A38

View File

@ -42,8 +42,16 @@ public static class MastodonHelper
requestContent.Headers.ContentType = new MediaTypeHeaderValue("application/activity+json");
client.DefaultRequestHeaders.Date = date;
var response = await client.PostAsync($"https://{targetHost}/inbox", requestContent);
return await response.Content.ReadAsStringAsync();
try
{
var response = await client.PostAsync($"https://{targetHost}/inbox", requestContent);
return await response.Content.ReadAsStringAsync();
}
catch (Exception e)
{
Console.WriteLine($"Exception {e.Message} when connecting to {targetHost}");
throw;
}
}
public static async Task ProcessInstanceFollowAsync(ActivityPubModel request)