From 2583a9f6e85dcc83940c763f83bea6a48c6d3528 Mon Sep 17 00:00:00 2001 From: lain Date: Fri, 23 Feb 2018 15:00:19 +0100 Subject: [PATCH] More logging. --- lib/pleroma/web/activity_pub/activity_pub.ex | 14 ++++++++------ lib/pleroma/web/ostatus/ostatus.ex | 10 ++++++++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index d59346042..c27ec2c6b 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -288,6 +288,8 @@ def fetch_and_prepare_user_from_ap_id(ap_id) do } {:ok, user_data} + else + e -> Logger.error("Could not user at fetch #{ap_id}, #{inspect(e)}") end end @@ -353,12 +355,12 @@ def fetch_object_from_id(id) do {:ok, Object.get_by_ap_id(activity.data["object"]["id"])} else object = %Object{} -> {:ok, object} - e -> - Logger.info("Couldn't get object via AP, trying out OStatus fetching...") - case OStatus.fetch_activity_from_url(id) do - {:ok, [activity | _]} -> {:ok, Object.get_by_ap_id(activity.data["object"]["id"])} - _ -> e - end + e -> + Logger.info("Couldn't get object via AP, trying out OStatus fetching...") + case OStatus.fetch_activity_from_url(id) do + {:ok, [activity | _]} -> {:ok, Object.get_by_ap_id(activity.data["object"]["id"])} + e -> e + end end end end diff --git a/lib/pleroma/web/ostatus/ostatus.ex b/lib/pleroma/web/ostatus/ostatus.ex index 91c4474c5..3f5cfdc8a 100644 --- a/lib/pleroma/web/ostatus/ostatus.ex +++ b/lib/pleroma/web/ostatus/ostatus.ex @@ -292,7 +292,10 @@ def fetch_activity_from_atom_url(url) do with {:ok, %{body: body, status_code: code}} when code in 200..299 <- @httpoison.get(url, [Accept: "application/atom+xml"], follow_redirect: true, timeout: 10000, recv_timeout: 20000) do Logger.debug("Got document from #{url}, handling...") handle_incoming(body) - else e -> Logger.debug("Couldn't get #{url}: #{inspect(e)}") + else + e -> + Logger.debug("Couldn't get #{url}: #{inspect(e)}") + e end end @@ -301,7 +304,10 @@ def fetch_activity_from_html_url(url) do with {:ok, %{body: body}} <- @httpoison.get(url, [], follow_redirect: true, timeout: 10000, recv_timeout: 20000), {:ok, atom_url} <- get_atom_url(body) do fetch_activity_from_atom_url(atom_url) - else e -> Logger.debug("Couldn't get #{url}: #{inspect(e)}") + else + e -> + Logger.debug("Couldn't get #{url}: #{inspect(e)}") + e end end