Slightly nicer webfinger error handling.
authorRoger Braun <roger@rogerbraun.net>
Thu, 3 Aug 2017 12:14:48 +0000 (14:14 +0200)
committerRoger Braun <roger@rogerbraun.net>
Thu, 3 Aug 2017 12:14:48 +0000 (14:14 +0200)
lib/pleroma/web/web_finger/web_finger_controller.ex

index d8959a96f13e6b5688393fb79da22e9f685bc6ff..d4536fc46b2beed0be231fe59824025a38c63905 100644 (file)
@@ -12,10 +12,12 @@ defmodule Pleroma.Web.WebFinger.WebFingerController do
   end
 
   def webfinger(conn, %{"resource" => resource}) do
-    {:ok, response} = WebFinger.webfinger(resource)
-
-    conn
-    |> put_resp_content_type("application/xrd+xml")
-    |> send_resp(200, response)
+    with {:ok, response} <- WebFinger.webfinger(resource) do
+      conn
+      |> put_resp_content_type("application/xrd+xml")
+      |> send_resp(200, response)
+    else
+      _e -> send_resp(conn, 404, "Couldn't find user")
+    end
   end
 end