From b94bf2ad87c9025e35fb9e3c2e45d8ac0539debe Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 20 Oct 2020 10:06:58 +0200 Subject: [PATCH] Fix a credo issue Signed-off-by: Thomas Citharel --- lib/graphql/resolvers/resource.ex | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/graphql/resolvers/resource.ex b/lib/graphql/resolvers/resource.ex index 2ea2f7603..d68439f58 100644 --- a/lib/graphql/resolvers/resource.ex +++ b/lib/graphql/resolvers/resource.ex @@ -196,9 +196,10 @@ defmodule Mobilizon.GraphQL.Resolvers.Resource do } } = _resolution ) do - with {:ok, data} when is_map(data) <- Parser.parse(resource_url) do - {:ok, struct(Metadata, data)} - else + case Parser.parse(resource_url) do + {:ok, data} when is_map(data) -> + {:ok, struct(Metadata, data)} + {:error, _err} -> Logger.warn("Error while fetching preview from #{inspect(resource_url)}") {:error, :unknown_resource}