From f445a1b3762b8ef67a86eab8390457b5bf70f62e Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Fri, 15 Sep 2017 08:18:29 +0200 Subject: [PATCH] Don't die on fetching problems. --- lib/pleroma/web/ostatus/ostatus.ex | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/pleroma/web/ostatus/ostatus.ex b/lib/pleroma/web/ostatus/ostatus.ex index 882226172..1fd868a90 100644 --- a/lib/pleroma/web/ostatus/ostatus.ex +++ b/lib/pleroma/web/ostatus/ostatus.ex @@ -300,12 +300,18 @@ defmodule Pleroma.Web.OStatus do end def fetch_activity_from_url(url) do - with {:ok, activities} when length(activities) > 0 <- fetch_activity_from_atom_url(url) do - {:ok, activities} - else - _e -> with {:ok, activities} <- fetch_activity_from_html_url(url) do - {:ok, activities} - end + try do + with {:ok, activities} when length(activities) > 0 <- fetch_activity_from_atom_url(url) do + {:ok, activities} + else + _e -> with {:ok, activities} <- fetch_activity_from_html_url(url) do + {:ok, activities} + end + end + rescue + e -> + Logger.debug("Couldn't get #{url}: #{inspect(e)}") + {:error, "Couldn't get #{url}: #{inspect(e)}"} end end end -- 2.45.2