chiya/lib/chiya_web/error.ex

14 lines
364 B
Elixir
Raw Normal View History

defmodule ChiyaWeb.Error do
2023-03-31 16:58:10 +02:00
import Plug.Conn, only: [put_status: 2]
import Phoenix.Controller, only: [put_view: 2, render: 3]
2023-07-07 10:14:40 +02:00
plug :put_root_layout, {ChiyaWeb.Layouts, :root_error}
2023-07-07 10:14:31 +02:00
2023-03-31 16:58:10 +02:00
def render_error(conn, :not_found, assigns \\ []) do
conn
2023-07-07 10:10:22 +02:00
|> put_status(:not_found)
|> put_view(ChiyaWeb.ErrorHTML)
|> render("404.html", assigns)
end
2023-03-31 16:58:10 +02:00
end