Current section
Files
Jump to
Current section
Files
lib/jaya_currency_converter_web/controllers/fallback_controller.ex
defmodule JayaCurrencyConverterWeb.FallbackController do
@moduledoc false
use JayaCurrencyConverterWeb, :controller
def call(conn, {:error, %Ecto.Changeset{} = changeset}) do
conn
|> put_status(:not_acceptable)
|> json(%{error: changeset})
end
def call(conn, {:error, msg}) do
conn
|> put_status(:not_found)
|> json(%{error: msg})
end
end