Better error handling for ActivityPubController

This commit is contained in:
lain 2018-06-03 19:58:59 +02:00
commit 06439f64d0
3 changed files with 11 additions and 8 deletions

View file

@ -27,9 +27,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|> json(ObjectView.render("object.json", %{object: object}))
else
{:public?, false} ->
conn
|> put_status(404)
|> json("Not found")
{:error, :not_found}
end
end
@ -107,6 +105,12 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
json(conn, "ok")
end
def errors(conn, {:error, :not_found}) do
conn
|> put_status(404)
|> json("Not found")
end
def errors(conn, _e) do
conn
|> put_status(500)