Add federator error logging

This commit is contained in:
Shadowfacts 2021-08-25 22:47:08 -04:00
parent ef3b435a8d
commit c942d1b955
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 11 additions and 1 deletions

View File

@ -81,6 +81,9 @@ defmodule Clacks.ActivityPub.Federator do
{:ok, %HTTPoison.Response{status_code: status_code}} when status_code in 200..299 ->
:ok
{:ok, %HTTPoison.Response{status_code: status_code, body: body}} ->
{:error, "unexpected response code #{status_code}: #{inspect(body)}"}
{:error, _} = err ->
err
end

View File

@ -10,6 +10,13 @@ defmodule Clacks.Worker.Federate do
activity = Repo.get(Activity, activity_id)
actor = Repo.get(Actor, actor_id)
:ok = ActivityPub.Federator.federate_to_involved(activity, actor)
case ActivityPub.Federator.federate_to_involved(activity, actor) do
:ok ->
:ok
{:error, reason} ->
Logger.error("Error federating '#{activity_id}' to '#{actor_id}': #{inspect(reason)}")
{:error, reason}
end
end
end