X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpleroma%2Fweb%2Fadmin_api%2Fcontrollers%2Ffallback_controller.ex;h=45d8815b5e4a3666b184e4036228cad9f2f52fd3;hb=0c8da6466e9fd01b63e9224f9ac18655fd8bf86b;hp=9f7bb92ce74bfb402627ceddc56647e310507d62;hpb=9de9760aa696657400c762d46dced273c3475be4;p=akkoma
diff --git a/lib/pleroma/web/admin_api/controllers/fallback_controller.ex b/lib/pleroma/web/admin_api/controllers/fallback_controller.ex
index 9f7bb92ce..45d8815b5 100644
--- a/lib/pleroma/web/admin_api/controllers/fallback_controller.ex
+++ b/lib/pleroma/web/admin_api/controllers/fallback_controller.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.AdminAPI.FallbackController do
@@ -8,13 +8,19 @@ defmodule Pleroma.Web.AdminAPI.FallbackController do
def call(conn, {:error, :not_found}) do
conn
|> put_status(:not_found)
- |> json(dgettext("errors", "Not found"))
+ |> json(%{error: dgettext("errors", "Not found")})
end
def call(conn, {:error, reason}) do
conn
|> put_status(:bad_request)
- |> json(reason)
+ |> json(%{error: reason})
+ end
+
+ def call(conn, {:errors, errors}) do
+ conn
+ |> put_status(:bad_request)
+ |> json(%{errors: errors})
end
def call(conn, {:param_cast, _}) do
@@ -26,6 +32,6 @@ defmodule Pleroma.Web.AdminAPI.FallbackController do
def call(conn, _) do
conn
|> put_status(:internal_server_error)
- |> json(dgettext("errors", "Something went wrong"))
+ |> json(%{error: dgettext("errors", "Something went wrong")})
end
end