1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.AdminAPI.FallbackController do
6 use Pleroma.Web, :controller
8 def call(conn, {:error, :not_found}) do
10 |> put_status(:not_found)
11 |> json(%{error: dgettext("errors", "Not found")})
14 def call(conn, {:error, reason}) do
16 |> put_status(:bad_request)
17 |> json(%{error: reason})
20 def call(conn, {:errors, errors}) do
22 |> put_status(:bad_request)
23 |> json(%{errors: errors})
26 def call(conn, {:param_cast, _}) do
28 |> put_status(:bad_request)
29 |> json(dgettext("errors", "Invalid parameters"))
34 |> put_status(:internal_server_error)
35 |> json(%{error: dgettext("errors", "Something went wrong")})