Slightly nicer webfinger error handling.

This commit is contained in:
Roger Braun 2017-08-03 14:14:48 +02:00
parent 571f07abe3
commit 7b0dd964be
1 changed files with 7 additions and 5 deletions

View File

@ -12,10 +12,12 @@ def host_meta(conn, _params) do
end end
def webfinger(conn, %{"resource" => resource}) do def webfinger(conn, %{"resource" => resource}) do
{:ok, response} = WebFinger.webfinger(resource) with {:ok, response} <- WebFinger.webfinger(resource) do
conn conn
|> put_resp_content_type("application/xrd+xml") |> put_resp_content_type("application/xrd+xml")
|> send_resp(200, response) |> send_resp(200, response)
else
_e -> send_resp(conn, 404, "Couldn't find user")
end
end end
end end