From 7b0dd964bee2974e97280aceedae95c4dbc7b3c9 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Thu, 3 Aug 2017 14:14:48 +0200 Subject: [PATCH] Slightly nicer webfinger error handling. --- lib/pleroma/web/web_finger/web_finger_controller.ex | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/web/web_finger/web_finger_controller.ex b/lib/pleroma/web/web_finger/web_finger_controller.ex index d8959a96f..d4536fc46 100644 --- a/lib/pleroma/web/web_finger/web_finger_controller.ex +++ b/lib/pleroma/web/web_finger/web_finger_controller.ex @@ -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 -- 2.45.2