Packages

A modular and easily customizable content management library that gives you pretty much everything you need for your basic phoenix project in terms of content-management.

Current section

Files

Jump to
elph lib elph_web controllers fallback_controller.ex
Raw

lib/elph_web/controllers/fallback_controller.ex

defmodule ElphWeb.FallbackController do
@moduledoc false
use ElphWeb, :controller
def call(conn, {:error, %Ecto.Changeset{} = changeset}) do
conn
|> put_status(:unprocessable_entity)
|> put_view(ElphWeb.ChangesetView)
|> render("error.json", changeset: changeset)
end
def call(conn, {:error, :not_found}) do
conn
|> put_status(:not_found)
|> put_view(ElphWeb.ErrorView)
|> render(:"404")
end
end