AttachmentValidator: directly embed url schema and pass it fix_media_type
[akkoma] / lib / pleroma / instances / instance.ex
index 711c42158b1580b1a88da2c1f26cdadbc715fa36..8bf53c090a8cc07a7df4ddb775af4cb8121535a3 100644 (file)
@@ -14,6 +14,8 @@ defmodule Pleroma.Instances.Instance do
   import Ecto.Query
   import Ecto.Changeset
 
+  require Logger
+
   schema "instances" do
     field(:host, :string)
     field(:unreachable_since, :naive_datetime_usec)
@@ -145,6 +147,10 @@ defmodule Pleroma.Instances.Instance do
 
       favicon
     end
+  rescue
+    e ->
+      Logger.warn("Instance.get_or_update_favicon(\"#{host}\") error: #{inspect(e)}")
+      nil
   end
 
   defp scrape_favicon(%URI{} = instance_uri) do
@@ -165,7 +171,12 @@ defmodule Pleroma.Instances.Instance do
         _ -> nil
       end
     rescue
-      _ -> nil
+      e ->
+        Logger.warn(
+          "Instance.scrape_favicon(\"#{to_string(instance_uri)}\") error: #{inspect(e)}"
+        )
+
+        nil
     end
   end
 end