Don't die on fetching problems.

This commit is contained in:
Roger Braun 2017-09-15 08:18:29 +02:00
parent 3ca853fb61
commit f445a1b376

View File

@ -300,12 +300,18 @@ defmodule Pleroma.Web.OStatus do
end end
def fetch_activity_from_url(url) do def fetch_activity_from_url(url) do
with {:ok, activities} when length(activities) > 0 <- fetch_activity_from_atom_url(url) do try do
{:ok, activities} with {:ok, activities} when length(activities) > 0 <- fetch_activity_from_atom_url(url) do
else {:ok, activities}
_e -> with {:ok, activities} <- fetch_activity_from_html_url(url) do else
{:ok, activities} _e -> with {:ok, activities} <- fetch_activity_from_html_url(url) do
end {:ok, activities}
end
end
rescue
e ->
Logger.debug("Couldn't get #{url}: #{inspect(e)}")
{:error, "Couldn't get #{url}: #{inspect(e)}"}
end end
end end
end end