commit: 2346807ac93d5acb9901823cceaffe5c305c1e20
parent 2e9515578a689428027ca7084d5c9b0d0b4a60ba
Author: Mark Felder <feld@feld.me>
Date: Wed, 28 Aug 2024 17:44:33 -0400
Annotate error cases
Diffstat:
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/lib/pleroma/workers/receiver_worker.ex b/lib/pleroma/workers/receiver_worker.ex
@@ -61,17 +61,21 @@ defmodule Pleroma.Workers.ReceiverWorker do
defp process_errors(errors) do
case errors do
- {:error, :origin_containment_failed} -> {:cancel, :origin_containment_failed}
- {:error, :already_present} -> {:cancel, :already_present}
- {:error, {:validate_object, _} = reason} -> {:cancel, reason}
+ # User fetch failures
+ {:error, :not_found} = reason -> {:cancel, reason}
+ {:error, :forbidden} = reason -> {:cancel, reason}
+ # Inactive user
+ {:user_active, false} = reason -> {:cancel, reason}
+ # Validator will error and return a changeset error
+ # e.g., duplicate activities or if the object was deleted
{:error, {:validate, {:error, _changeset} = reason}} -> {:cancel, reason}
+ # MRFs will return a reject
{:error, {:reject, _} = reason} -> {:cancel, reason}
+ # HTTP Sigs
{:signature, false} -> {:cancel, :invalid_signature}
- {:error, "Object has been deleted"} = reason -> {:cancel, reason}
+ {:error, :origin_containment_failed} -> {:cancel, :origin_containment_failed}
+ {:error, {:validate_object, _} = reason} -> {:cancel, reason}
{:error, {:side_effects, {:error, :no_object_actor}} = reason} -> {:cancel, reason}
- {:error, :not_found} = reason -> {:cancel, reason}
- {:error, :forbidden} = reason -> {:cancel, reason}
- {:user_active, false} = reason -> {:cancel, reason}
{:error, _} = e -> e
e -> {:error, e}
end