Add details of object in exception when AP object as no
actor/attributedTo Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
bd64e19af4
commit
3c8a2a1313
@ -337,8 +337,9 @@ defmodule Mobilizon.Federation.ActivityPub.Utils do
|
|||||||
message: "Object contains an actor object with invalid type: #{inspect(type)}"
|
message: "Object contains an actor object with invalid type: #{inspect(type)}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_actor(%{"actor" => nil, "attributedTo" => nil}) do
|
def get_actor(%{"actor" => nil, "attributedTo" => nil} = object) do
|
||||||
raise ArgumentError, message: "Object contains both actor and attributedTo fields being null"
|
raise ArgumentError,
|
||||||
|
message: "Object contains both actor and attributedTo fields being null: #{inspect(object)}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_actor(%{"actor" => _}) do
|
def get_actor(%{"actor" => _}) do
|
||||||
|
@ -129,7 +129,7 @@ defmodule Mobilizon.Federation.ActivityPub.UtilsTest do
|
|||||||
|
|
||||||
test "with no actor information" do
|
test "with no actor information" do
|
||||||
assert_raise ArgumentError,
|
assert_raise ArgumentError,
|
||||||
"Object contains both actor and attributedTo fields being null",
|
"Object contains both actor and attributedTo fields being null: %{\"actor\" => nil, \"attributedTo\" => nil}",
|
||||||
fn ->
|
fn ->
|
||||||
Utils.get_actor(%{
|
Utils.get_actor(%{
|
||||||
"actor" => nil,
|
"actor" => nil,
|
||||||
|
Loading…
Reference in New Issue
Block a user