object fetcher error handling

This commit is contained in:
stwf 2019-10-24 12:08:34 -04:00
parent 07a6f8b8a3
commit 2ab072f949

View file

@ -90,6 +90,9 @@ defmodule Pleroma.Object.Fetcher do
{:fetch_object, %Object{} = object} ->
{:ok, object}
{:fetch, {:error, error}} ->
{:error, error}
e ->
e
end
@ -110,6 +113,9 @@ defmodule Pleroma.Object.Fetcher do
with {:ok, object} <- fetch_object_from_id(id, options) do
object
else
{:error, %Tesla.Mock.Error{}} ->
nil
e ->
Logger.error("Error while fetching #{id}: #{inspect(e)}")
nil
@ -170,6 +176,9 @@ defmodule Pleroma.Object.Fetcher do
{:scheme, _} ->
{:error, "Unsupported URI scheme"}
{:error, e} ->
{:error, e}
e ->
{:error, e}
end